<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE LambdaCase #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE NondecreasingIndentation #-}</span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# LANGUAGE GeneralizedNewtypeDeriving #-}</span><span>
</span><span id="line-5"></span><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
</span><span id="line-6"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-7"></span><span>
</span><span id="line-8"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Tc.Utils.Backpack</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-9"></span><span>    </span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#findExtraSigImports%27"><span class="hs-identifier">findExtraSigImports'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-10"></span><span>    </span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#findExtraSigImports"><span class="hs-identifier">findExtraSigImports</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-11"></span><span>    </span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#implicitRequirements%27"><span class="hs-identifier">implicitRequirements'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-12"></span><span>    </span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#implicitRequirements"><span class="hs-identifier">implicitRequirements</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-13"></span><span>    </span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#checkUnit"><span class="hs-identifier">checkUnit</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-14"></span><span>    </span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#tcRnCheckUnit"><span class="hs-identifier">tcRnCheckUnit</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>    </span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#tcRnMergeSignatures"><span class="hs-identifier">tcRnMergeSignatures</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-16"></span><span>    </span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#mergeSignatures"><span class="hs-identifier">mergeSignatures</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>    </span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#tcRnInstantiateSignature"><span class="hs-identifier">tcRnInstantiateSignature</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>    </span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#instantiateSignature"><span class="hs-identifier">instantiateSignature</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-19"></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-20"></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#defaultFixity"><span class="hs-identifier">defaultFixity</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#TypeOrKind"><span class="hs-identifier">TypeOrKind</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.State.html"><span class="hs-identifier">GHC.Unit.State</span></a></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Export.html"><span class="hs-identifier">GHC.Tc.Gen.Export</span></a></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html"><span class="hs-identifier">GHC.Types.Name.Reader</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html"><span class="hs-identifier">GHC.Tc.Utils.Monad</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.TyCl.Utils.html"><span class="hs-identifier">GHC.Tc.TyCl.Utils</span></a></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.InstEnv.html"><span class="hs-identifier">GHC.Core.InstEnv</span></a></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html"><span class="hs-identifier">GHC.Core.FamInstEnv</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Instantiate.html"><span class="hs-identifier">GHC.Tc.Utils.Instantiate</span></a></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.IfaceToCore.html"><span class="hs-identifier">GHC.IfaceToCore</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcMType.html"><span class="hs-identifier">GHC.Tc.Utils.TcMType</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html"><span class="hs-identifier">GHC.Tc.Utils.TcType</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Solver.html"><span class="hs-identifier">GHC.Tc.Solver</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html"><span class="hs-identifier">GHC.Tc.Types.Constraint</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html"><span class="hs-identifier">GHC.Tc.Types.Origin</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Iface.Load.html"><span class="hs-identifier">GHC.Iface.Load</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html"><span class="hs-identifier">GHC.Rename.Names</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html"><span class="hs-identifier">GHC.Types.Name.Env</span></a></span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html"><span class="hs-identifier">GHC.Types.Name.Set</span></a></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html"><span class="hs-identifier">GHC.Types.Avail</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Multiplicity.html"><span class="hs-identifier">GHC.Core.Multiplicity</span></a></span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Rename.Fixity.html"><span class="hs-identifier">GHC.Rename.Fixity</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Rename.Fixity.html#lookupFixityRn"><span class="hs-identifier">lookupFixityRn</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html"><span class="hs-identifier">GHC.Data.Maybe</span></a></span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Env.html"><span class="hs-identifier">GHC.Tc.Utils.Env</span></a></span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.html"><span class="hs-identifier">GHC.Types.Var</span></a></span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Iface.Syntax.html"><span class="hs-identifier">GHC.Iface.Syntax</span></a></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../containers/src/Data.Map.html#"><span class="hs-identifier">Data.Map</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Map</span></span><span>
</span><span id="line-62"></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Finder.html"><span class="hs-identifier">GHC.Driver.Finder</span></a></span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.DSet.html"><span class="hs-identifier">GHC.Types.Unique.DSet</span></a></span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html"><span class="hs-identifier">GHC.Types.Name.Shape</span></a></span><span>
</span><span id="line-66"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Errors.html"><span class="hs-identifier">GHC.Tc.Errors</span></a></span><span>
</span><span id="line-67"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Unify.html"><span class="hs-identifier">GHC.Tc.Utils.Unify</span></a></span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Iface.Rename.html"><span class="hs-identifier">GHC.Iface.Rename</span></a></span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-70"></span><span>
</span><span id="line-71"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Foldable.html#find"><span class="hs-identifier">find</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-73"></span><span>
</span><span id="line-74"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.Tc.Module.html"><span class="hs-identifier">GHC.Tc.Module</span></a></span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-78"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#fixityMisMatch"><span class="hs-identifier hs-type">fixityMisMatch</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyThing"><span class="hs-identifier hs-type">TyThing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Fixity"><span class="hs-identifier hs-type">Fixity</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Fixity"><span class="hs-identifier hs-type">Fixity</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-79"></span><span id="fixityMisMatch"><span class="annot"><span class="annottext">fixityMisMatch :: TyThing -&gt; Fixity -&gt; Fixity -&gt; SDoc
</span><a href="GHC.Tc.Utils.Backpack.html#fixityMisMatch"><span class="hs-identifier hs-var hs-var">fixityMisMatch</span></a></span></span><span> </span><span id="local-6989586621681161231"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161231"><span class="hs-identifier hs-var">real_thing</span></a></span></span><span> </span><span id="local-6989586621681161230"><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161230"><span class="hs-identifier hs-var">real_fixity</span></a></span></span><span> </span><span id="local-6989586621681161229"><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161229"><span class="hs-identifier hs-var">sig_fixity</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-80"></span><span>    </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TyThing -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161231"><span class="hs-identifier hs-var">real_thing</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;has conflicting fixities in the module&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-81"></span><span>          </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;and its hsig file&quot;</span></span><span class="hs-special">,</span><span>
</span><span id="line-82"></span><span>          </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Main module:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Fixity -&gt; SDoc
</span><a href="#local-6989586621681161224"><span class="hs-identifier hs-var">ppr_fix</span></a></span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161230"><span class="hs-identifier hs-var">real_fixity</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-83"></span><span>          </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Hsig file:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Fixity -&gt; SDoc
</span><a href="#local-6989586621681161224"><span class="hs-identifier hs-var">ppr_fix</span></a></span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161229"><span class="hs-identifier hs-var">sig_fixity</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-84"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-85"></span><span>    </span><span id="local-6989586621681161224"><span class="annot"><span class="annottext">ppr_fix :: Fixity -&gt; SDoc
</span><a href="#local-6989586621681161224"><span class="hs-identifier hs-var hs-var">ppr_fix</span></a></span></span><span> </span><span id="local-6989586621681161220"><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161220"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-86"></span><span>        </span><span class="annot"><span class="annottext">Fixity -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161220"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-87"></span><span>        </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161220"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Fixity -&gt; Fixity -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="GHC.Types.Basic.html#defaultFixity"><span class="hs-identifier hs-var">defaultFixity</span></a></span><span>
</span><span id="line-88"></span><span>            </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;default&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-89"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#checkHsigDeclM"><span class="hs-identifier hs-type">checkHsigDeclM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyThing"><span class="hs-identifier hs-type">TyThing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyThing"><span class="hs-identifier hs-type">TyThing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-92"></span><span id="checkHsigDeclM"><span class="annot"><span class="annottext">checkHsigDeclM :: ModIface -&gt; TyThing -&gt; TyThing -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Backpack.html#checkHsigDeclM"><span class="hs-identifier hs-var hs-var">checkHsigDeclM</span></a></span></span><span> </span><span id="local-6989586621681161216"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681161216"><span class="hs-identifier hs-var">sig_iface</span></a></span></span><span> </span><span id="local-6989586621681161215"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161215"><span class="hs-identifier hs-var">sig_thing</span></a></span></span><span> </span><span id="local-6989586621681161214"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161214"><span class="hs-identifier hs-var">real_thing</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-93"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681161213"><span class="annot"><span class="annottext">name :: Name
</span><a href="#local-6989586621681161213"><span class="hs-identifier hs-var hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyThing -&gt; Name
forall a. NamedThing a =&gt; a -&gt; Name
</span><a href="GHC.Types.Name.html#getName"><span class="hs-identifier hs-var">getName</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161214"><span class="hs-identifier hs-var">real_thing</span></a></span><span>
</span><span id="line-94"></span><span>    </span><span class="hs-comment">-- TODO: Distinguish between signature merging and signature</span><span>
</span><span id="line-95"></span><span>    </span><span class="hs-comment">-- implementation cases.</span><span>
</span><span id="line-96"></span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; TyThing -&gt; TyThing -&gt; TcRn ()
</span><a href="GHC.Tc.Module.html#checkBootDeclM"><span class="hs-identifier hs-var">checkBootDeclM</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161215"><span class="hs-identifier hs-var">sig_thing</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161214"><span class="hs-identifier hs-var">real_thing</span></a></span><span>
</span><span id="line-97"></span><span>    </span><span id="local-6989586621681161210"><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161210"><span class="hs-identifier hs-var">real_fixity</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; RnM Fixity
</span><a href="GHC.Rename.Fixity.html#lookupFixityRn"><span class="hs-identifier hs-var">lookupFixityRn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161213"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-98"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681161209"><span class="annot"><span class="annottext">sig_fixity :: Fixity
</span><a href="#local-6989586621681161209"><span class="hs-identifier hs-var hs-var">sig_fixity</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ModIfaceBackend -&gt; OccName -&gt; Maybe Fixity
</span><a href="GHC.Driver.Types.html#mi_fix_fn"><span class="hs-identifier hs-var hs-var">mi_fix_fn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; IfaceBackendExts 'ModIfaceFinal
forall (phase :: ModIfacePhase).
ModIface_ phase -&gt; IfaceBackendExts phase
</span><a href="GHC.Driver.Types.html#mi_final_exts"><span class="hs-identifier hs-var hs-var">mi_final_exts</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681161216"><span class="hs-identifier hs-var">sig_iface</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161213"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-99"></span><span>                        </span><span class="annot"><span class="annottext">Maybe Fixity
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="GHC.Types.Basic.html#defaultFixity"><span class="hs-identifier hs-var">defaultFixity</span></a></span><span>
</span><span id="line-100"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681161205"><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161205"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161205"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-101"></span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; TcRn () -&gt; TcRn ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161210"><span class="hs-identifier hs-var">real_fixity</span></a></span><span> </span><span class="annot"><span class="annottext">Fixity -&gt; Fixity -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161209"><span class="hs-identifier hs-var">sig_fixity</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; TcRn ()) -&gt; TcRn () -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-102"></span><span>      </span><span class="annot"><span class="annottext">SrcSpan -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#addErrAt"><span class="hs-identifier hs-var">addErrAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SrcSpan
</span><a href="GHC.Types.Name.html#nameSrcSpan"><span class="hs-identifier hs-var">nameSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161213"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-103"></span><span>        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyThing -&gt; Fixity -&gt; Fixity -&gt; SDoc
</span><a href="GHC.Tc.Utils.Backpack.html#fixityMisMatch"><span class="hs-identifier hs-var">fixityMisMatch</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161214"><span class="hs-identifier hs-var">real_thing</span></a></span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161210"><span class="hs-identifier hs-var">real_fixity</span></a></span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681161209"><span class="hs-identifier hs-var">sig_fixity</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span class="hs-comment">-- | Given a 'ModDetails' of an instantiated signature (note that the</span><span>
</span><span id="line-106"></span><span class="hs-comment">-- 'ModDetails' must be knot-tied consistently with the actual implementation)</span><span>
</span><span id="line-107"></span><span class="hs-comment">-- and a 'GlobalRdrEnv' constructed from the implementor of this interface,</span><span>
</span><span id="line-108"></span><span class="hs-comment">-- verify that the actual implementation actually matches the original</span><span>
</span><span id="line-109"></span><span class="hs-comment">-- interface.</span><span>
</span><span id="line-110"></span><span class="hs-comment">--</span><span>
</span><span id="line-111"></span><span class="hs-comment">-- Note that it is already assumed that the implementation *exports*</span><span>
</span><span id="line-112"></span><span class="hs-comment">-- a sufficient set of entities, since otherwise the renaming and then</span><span>
</span><span id="line-113"></span><span class="hs-comment">-- typechecking of the signature 'ModIface' would have failed.</span><span>
</span><span id="line-114"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#checkHsigIface"><span class="hs-identifier hs-type">checkHsigIface</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#GlobalRdrEnv"><span class="hs-identifier hs-type">GlobalRdrEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModDetails"><span class="hs-identifier hs-type">ModDetails</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-115"></span><span id="checkHsigIface"><span class="annot"><span class="annottext">checkHsigIface :: TcGblEnv -&gt; GlobalRdrEnv -&gt; ModIface -&gt; ModDetails -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Backpack.html#checkHsigIface"><span class="hs-identifier hs-var hs-var">checkHsigIface</span></a></span></span><span> </span><span id="local-6989586621681161199"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681161199"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span id="local-6989586621681161198"><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681161198"><span class="hs-identifier hs-var">gr</span></a></span></span><span> </span><span id="local-6989586621681161197"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681161197"><span class="hs-identifier hs-var">sig_iface</span></a></span></span><span>
</span><span id="line-116"></span><span>  </span><span class="annot"><a href="GHC.Driver.Types.html#ModDetails"><span class="hs-identifier hs-type">ModDetails</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">md_insts :: ModDetails -&gt; [ClsInst]
</span><a href="GHC.Driver.Types.html#md_insts"><span class="hs-identifier hs-var">md_insts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681161194"><span class="annot"><span class="annottext">[ClsInst]
</span><a href="#local-6989586621681161194"><span class="hs-identifier hs-var">sig_insts</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">md_fam_insts :: ModDetails -&gt; [FamInst]
</span><a href="GHC.Driver.Types.html#md_fam_insts"><span class="hs-identifier hs-var">md_fam_insts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681161192"><span class="annot"><span class="annottext">[FamInst]
</span><a href="#local-6989586621681161192"><span class="hs-identifier hs-var">sig_fam_insts</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-117"></span><span>               </span><span class="annot"><span class="annottext">md_types :: ModDetails -&gt; TypeEnv
</span><a href="GHC.Driver.Types.html#md_types"><span class="hs-identifier hs-var">md_types</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681161190"><span class="annot"><span class="annottext">TypeEnv
</span><a href="#local-6989586621681161190"><span class="hs-identifier hs-var">sig_type_env</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">md_exports :: ModDetails -&gt; [AvailInfo]
</span><a href="GHC.Driver.Types.html#md_exports"><span class="hs-identifier hs-var">md_exports</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681161188"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681161188"><span class="hs-identifier hs-var">sig_exports</span></a></span></span><span>   </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-118"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;checkHsigIface&quot;</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; TcRn ()) -&gt; SDoc -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span>
</span><span id="line-119"></span><span>        </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">TypeEnv -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TypeEnv
</span><a href="#local-6989586621681161190"><span class="hs-identifier hs-var">sig_type_env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[ClsInst] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[ClsInst]
</span><a href="#local-6989586621681161194"><span class="hs-identifier hs-var">sig_insts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[AvailInfo] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681161188"><span class="hs-identifier hs-var">sig_exports</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-120"></span><span>    </span><span class="annot"><span class="annottext">(Name -&gt; TcRn ()) -&gt; [Name] -&gt; TcRn ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcRn ()
</span><a href="#local-6989586621681161185"><span class="hs-identifier hs-var">check_export</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(AvailInfo -&gt; Name) -&gt; [AvailInfo] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; Name
</span><a href="GHC.Types.Avail.html#availName"><span class="hs-identifier hs-var">availName</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681161188"><span class="hs-identifier hs-var">sig_exports</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-121"></span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; TcRn () -&gt; TcRn ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/Control.Monad.html#unless"><span class="hs-identifier hs-var">unless</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[FamInst] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[FamInst]
</span><a href="#local-6989586621681161192"><span class="hs-identifier hs-var">sig_fam_insts</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; TcRn ()) -&gt; TcRn () -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-122"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; TcRn ()
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;GHC.Tc.Module.checkHsigIface: Cannot handle family &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span>
</span><span id="line-123"></span><span>               </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;instances in hsig files yet...&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-124"></span><span>    </span><span class="hs-comment">-- Delete instances so we don't look them up when</span><span>
</span><span id="line-125"></span><span>    </span><span class="hs-comment">-- checking instance satisfiability</span><span>
</span><span id="line-126"></span><span>    </span><span class="hs-comment">-- TODO: this should not be necessary</span><span>
</span><span id="line-127"></span><span>    </span><span id="local-6989586621681161180"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681161180"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-128"></span><span>    </span><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRn () -&gt; TcRn ()
forall gbl lcl a. gbl -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setGblEnv"><span class="hs-identifier hs-var">setGblEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681161180"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcg_inst_env :: InstEnv
</span><a href="GHC.Tc.Types.html#tcg_inst_env"><span class="hs-identifier hs-var">tcg_inst_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstEnv
</span><a href="GHC.Core.InstEnv.html#emptyInstEnv"><span class="hs-identifier hs-var">emptyInstEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-129"></span><span>                        </span><span class="annot"><span class="annottext">tcg_fam_inst_env :: FamInstEnv
</span><a href="GHC.Tc.Types.html#tcg_fam_inst_env"><span class="hs-identifier hs-var">tcg_fam_inst_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FamInstEnv
</span><a href="GHC.Core.FamInstEnv.html#emptyFamInstEnv"><span class="hs-identifier hs-var">emptyFamInstEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-130"></span><span>                        </span><span class="annot"><span class="annottext">tcg_insts :: [ClsInst]
</span><a href="GHC.Tc.Types.html#tcg_insts"><span class="hs-identifier hs-var">tcg_insts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-131"></span><span>                        </span><span class="annot"><span class="annottext">tcg_fam_insts :: [FamInst]
</span><a href="GHC.Tc.Types.html#tcg_fam_insts"><span class="hs-identifier hs-var">tcg_fam_insts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">}</span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; TcRn ()) -&gt; TcRn () -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-132"></span><span>    </span><span class="annot"><span class="annottext">(ClsInst -&gt; TcRn ()) -&gt; [ClsInst] -&gt; TcRn ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInst -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Backpack.html#check_inst"><span class="hs-identifier hs-var">check_inst</span></a></span><span> </span><span class="annot"><span class="annottext">[ClsInst]
</span><a href="#local-6989586621681161194"><span class="hs-identifier hs-var">sig_insts</span></a></span><span>
</span><span id="line-133"></span><span>    </span><span class="annot"><span class="annottext">TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#failIfErrsM"><span class="hs-identifier hs-var">failIfErrsM</span></a></span><span>
</span><span id="line-134"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-135"></span><span>    </span><span class="hs-comment">-- NB: the Names in sig_type_env are bogus.  Let's say we have H.hsig</span><span>
</span><span id="line-136"></span><span>    </span><span class="hs-comment">-- in package p that defines T; and we implement with himpl:H.  Then the</span><span>
</span><span id="line-137"></span><span>    </span><span class="hs-comment">-- Name is p[himpl:H]:H.T, NOT himplH:H.T.  That's OK but we just</span><span>
</span><span id="line-138"></span><span>    </span><span class="hs-comment">-- have to look up the right name.</span><span>
</span><span id="line-139"></span><span>    </span><span id="local-6989586621681161169"><span class="annot"><span class="annottext">sig_type_occ_env :: OccEnv TyThing
</span><a href="#local-6989586621681161169"><span class="hs-identifier hs-var hs-var">sig_type_occ_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(OccName, TyThing)] -&gt; OccEnv TyThing
forall a. [(OccName, a)] -&gt; OccEnv a
</span><a href="GHC.Types.Name.Occurrence.html#mkOccEnv"><span class="hs-identifier hs-var">mkOccEnv</span></a></span><span>
</span><span id="line-140"></span><span>                     </span><span class="annot"><span class="annottext">([(OccName, TyThing)] -&gt; OccEnv TyThing)
-&gt; ([TyThing] -&gt; [(OccName, TyThing)])
-&gt; [TyThing]
-&gt; OccEnv TyThing
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(TyThing -&gt; (OccName, TyThing))
-&gt; [TyThing] -&gt; [(OccName, TyThing)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681161166"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161166"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyThing -&gt; Name
forall a. NamedThing a =&gt; a -&gt; Name
</span><a href="GHC.Types.Name.html#getName"><span class="hs-identifier hs-var">getName</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161166"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161166"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-141"></span><span>                     </span><span class="annot"><span class="annottext">([TyThing] -&gt; OccEnv TyThing) -&gt; [TyThing] -&gt; OccEnv TyThing
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TypeEnv -&gt; [TyThing]
forall a. NameEnv a -&gt; [a]
</span><a href="GHC.Types.Name.Env.html#nameEnvElts"><span class="hs-identifier hs-var">nameEnvElts</span></a></span><span> </span><span class="annot"><span class="annottext">TypeEnv
</span><a href="#local-6989586621681161190"><span class="hs-identifier hs-var">sig_type_env</span></a></span><span>
</span><span id="line-142"></span><span>    </span><span id="local-6989586621681161163"><span class="annot"><span class="annottext">dfun_names :: [Name]
</span><a href="#local-6989586621681161163"><span class="hs-identifier hs-var hs-var">dfun_names</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ClsInst -&gt; Name) -&gt; [ClsInst] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInst -&gt; Name
forall a. NamedThing a =&gt; a -&gt; Name
</span><a href="GHC.Types.Name.html#getName"><span class="hs-identifier hs-var">getName</span></a></span><span> </span><span class="annot"><span class="annottext">[ClsInst]
</span><a href="#local-6989586621681161194"><span class="hs-identifier hs-var">sig_insts</span></a></span><span>
</span><span id="line-143"></span><span>    </span><span id="local-6989586621681161185"><span class="annot"><span class="annottext">check_export :: Name -&gt; TcRn ()
</span><a href="#local-6989586621681161185"><span class="hs-identifier hs-var hs-var">check_export</span></a></span></span><span> </span><span id="local-6989586621681161162"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161162"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-144"></span><span>      </span><span class="hs-comment">-- Skip instances, we'll check them later</span><span>
</span><span id="line-145"></span><span>      </span><span class="hs-comment">-- TODO: Actually this should never happen, because DFuns are</span><span>
</span><span id="line-146"></span><span>      </span><span class="hs-comment">-- never exported...</span><span>
</span><span id="line-147"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161162"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681161163"><span class="hs-identifier hs-var">dfun_names</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-148"></span><span>      </span><span class="hs-comment">-- See if we can find the type directly in the hsig ModDetails</span><span>
</span><span id="line-149"></span><span>      </span><span class="hs-comment">-- TODO: need to special case wired in names</span><span>
</span><span id="line-150"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681161160"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161160"><span class="hs-identifier hs-var">sig_thing</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">OccEnv TyThing -&gt; OccName -&gt; Maybe TyThing
forall a. OccEnv a -&gt; OccName -&gt; Maybe a
</span><a href="GHC.Types.Name.Occurrence.html#lookupOccEnv"><span class="hs-identifier hs-var">lookupOccEnv</span></a></span><span> </span><span class="annot"><span class="annottext">OccEnv TyThing
</span><a href="#local-6989586621681161169"><span class="hs-identifier hs-var">sig_type_occ_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161162"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-151"></span><span>        </span><span class="hs-comment">-- NB: We use tcLookupImported_maybe because we want to EXCLUDE</span><span>
</span><span id="line-152"></span><span>        </span><span class="hs-comment">-- tcg_env (TODO: but maybe this isn't relevant anymore).</span><span>
</span><span id="line-153"></span><span>        </span><span id="local-6989586621681161158"><span class="annot"><span class="annottext">MaybeErr SDoc TyThing
</span><a href="#local-6989586621681161158"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM (MaybeErr SDoc TyThing)
</span><a href="GHC.Iface.Load.html#tcLookupImported_maybe"><span class="hs-identifier hs-var">tcLookupImported_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161162"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-154"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">MaybeErr SDoc TyThing
</span><a href="#local-6989586621681161158"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-155"></span><span>          </span><span class="annot"><a href="GHC.Data.Maybe.html#Failed"><span class="hs-identifier hs-type">Failed</span></a></span><span> </span><span id="local-6989586621681161155"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681161155"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#addErr"><span class="hs-identifier hs-var">addErr</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681161155"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-156"></span><span>          </span><span class="annot"><a href="GHC.Data.Maybe.html#Succeeded"><span class="hs-identifier hs-type">Succeeded</span></a></span><span> </span><span id="local-6989586621681161152"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161152"><span class="hs-identifier hs-var">real_thing</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; TyThing -&gt; TyThing -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Backpack.html#checkHsigDeclM"><span class="hs-identifier hs-var">checkHsigDeclM</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681161197"><span class="hs-identifier hs-var">sig_iface</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161160"><span class="hs-identifier hs-var">sig_thing</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681161152"><span class="hs-identifier hs-var">real_thing</span></a></span><span>
</span><span id="line-157"></span><span>
</span><span id="line-158"></span><span>      </span><span class="hs-comment">-- The hsig did NOT define this function; that means it must</span><span>
</span><span id="line-159"></span><span>      </span><span class="hs-comment">-- be a reexport.  In this case, make sure the 'Name' of the</span><span>
</span><span id="line-160"></span><span>      </span><span class="hs-comment">-- reexport matches the 'Name exported here.</span><span>
</span><span id="line-161"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Reader.html#GRE"><span class="hs-identifier hs-type">GRE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">gre_name :: GlobalRdrElt -&gt; Name
</span><a href="GHC.Types.Name.Reader.html#gre_name"><span class="hs-identifier hs-var">gre_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681161149"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161149"><span class="hs-identifier hs-var">name'</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; OccName -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#lookupGlobalRdrEnv"><span class="hs-identifier hs-var">lookupGlobalRdrEnv</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681161198"><span class="hs-identifier hs-var">gr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161162"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-162"></span><span>        </span><span class="annot"><span class="annottext">Bool -&gt; TcRn () -&gt; TcRn ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161162"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Name -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161149"><span class="hs-identifier hs-var">name'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; TcRn ()) -&gt; TcRn () -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-163"></span><span>            </span><span class="hs-comment">-- See Note [Error reporting bad reexport]</span><span>
</span><span id="line-164"></span><span>            </span><span class="hs-comment">-- TODO: Actually this error swizzle doesn't work</span><span>
</span><span id="line-165"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681161147"><span class="annot"><span class="annottext">p :: GenLocated SrcSpan (IE (GhcPass 'Renamed)) -&gt; Bool
</span><a href="#local-6989586621681161147"><span class="hs-identifier hs-var hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681161145"><span class="annot"><span class="annottext">IE (GhcPass 'Renamed)
</span><a href="#local-6989586621681161145"><span class="hs-identifier hs-var">ie</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161162"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">IE (GhcPass 'Renamed) -&gt; [IdP (GhcPass 'Renamed)]
forall (p :: Pass). IE (GhcPass p) -&gt; [IdP (GhcPass p)]
</span><a href="GHC.Hs.ImpExp.html#ieNames"><span class="hs-identifier hs-var">ieNames</span></a></span><span> </span><span class="annot"><span class="annottext">IE (GhcPass 'Renamed)
</span><a href="#local-6989586621681161145"><span class="hs-identifier hs-var">ie</span></a></span><span>
</span><span id="line-166"></span><span>                </span><span id="local-6989586621681161143"><span class="annot"><span class="annottext">loc :: SrcSpan
</span><a href="#local-6989586621681161143"><span class="hs-identifier hs-var hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcGblEnv
-&gt; Maybe
     [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])]
</span><a href="GHC.Tc.Types.html#tcg_rn_exports"><span class="hs-identifier hs-var hs-var">tcg_rn_exports</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681161199"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-167"></span><span>                       </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681161141"><span class="annot"><span class="annottext">[(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])]
</span><a href="#local-6989586621681161141"><span class="hs-identifier hs-var">es</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681161140"><span class="annot"><span class="annottext">GenLocated SrcSpan (IE (GhcPass 'Renamed))
</span><a href="#local-6989586621681161140"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan (IE (GhcPass 'Renamed)) -&gt; Bool)
-&gt; [GenLocated SrcSpan (IE (GhcPass 'Renamed))]
-&gt; Maybe (GenLocated SrcSpan (IE (GhcPass 'Renamed)))
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Maybe a
</span><a href="../../base/src/Data.Foldable.html#find"><span class="hs-identifier hs-var">find</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (IE (GhcPass 'Renamed)) -&gt; Bool
</span><a href="#local-6989586621681161147"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])
 -&gt; GenLocated SrcSpan (IE (GhcPass 'Renamed)))
-&gt; [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])]
-&gt; [GenLocated SrcSpan (IE (GhcPass 'Renamed))]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])
-&gt; GenLocated SrcSpan (IE (GhcPass 'Renamed))
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])]
</span><a href="#local-6989586621681161141"><span class="hs-identifier hs-var">es</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-168"></span><span>                         </span><span class="hs-comment">-- TODO: maybe we can be a little more</span><span>
</span><span id="line-169"></span><span>                         </span><span class="hs-comment">-- precise here and use the Located</span><span>
</span><span id="line-170"></span><span>                         </span><span class="hs-comment">-- info for the *specific* name we matched.</span><span>
</span><span id="line-171"></span><span>                         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (IE (GhcPass 'Renamed)) -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (IE (GhcPass 'Renamed))
</span><a href="#local-6989586621681161140"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-172"></span><span>                       </span><span class="annot"><span class="annottext">Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; SrcSpan
</span><a href="GHC.Types.Name.html#nameSrcSpan"><span class="hs-identifier hs-var">nameSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161162"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-173"></span><span>            </span><span class="annot"><span class="annottext">SrcSpan -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#addErrAt"><span class="hs-identifier hs-var">addErrAt</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681161143"><span class="hs-identifier hs-var">loc</span></a></span><span>
</span><span id="line-174"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Name -&gt; Name -&gt; SDoc
</span><a href="GHC.Tc.Module.html#badReexportedBootThing"><span class="hs-identifier hs-var">badReexportedBootThing</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161162"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161149"><span class="hs-identifier hs-var">name'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-175"></span><span>      </span><span class="hs-comment">-- This should actually never happen, but whatever...</span><span>
</span><span id="line-176"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-177"></span><span>        </span><span class="annot"><span class="annottext">SrcSpan -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#addErrAt"><span class="hs-identifier hs-var">addErrAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SrcSpan
</span><a href="GHC.Types.Name.html#nameSrcSpan"><span class="hs-identifier hs-var">nameSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161162"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-178"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Name -&gt; String -&gt; SDoc
</span><a href="GHC.Tc.Module.html#missingBootThing"><span class="hs-identifier hs-var">missingBootThing</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681161162"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;exported by&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-179"></span><span>
</span><span id="line-180"></span><span class="hs-comment">-- Note [Error reporting bad reexport]</span><span>
</span><span id="line-181"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-182"></span><span class="hs-comment">-- NB: You want to be a bit careful about what location you report on reexports.</span><span>
</span><span id="line-183"></span><span class="hs-comment">-- If the name was declared in the hsig file, 'nameSrcSpan name' is indeed the</span><span>
</span><span id="line-184"></span><span class="hs-comment">-- correct source location.  However, if it was *reexported*, obviously the name</span><span>
</span><span id="line-185"></span><span class="hs-comment">-- is not going to have the right location.  In this case, we need to grovel in</span><span>
</span><span id="line-186"></span><span class="hs-comment">-- tcg_rn_exports to figure out where the reexport came from.</span><span>
</span><span id="line-187"></span><span>
</span><span id="line-188"></span><span>
</span><span id="line-189"></span><span>
</span><span id="line-190"></span><span class="hs-comment">-- | Checks if a 'ClsInst' is &quot;defined&quot;. In general, for hsig files we can't</span><span>
</span><span id="line-191"></span><span class="hs-comment">-- assume that the implementing file actually implemented the instances (they</span><span>
</span><span id="line-192"></span><span class="hs-comment">-- may be reexported from elsewhere).  Where should we look for the instances?</span><span>
</span><span id="line-193"></span><span class="hs-comment">-- We do the same as we would otherwise: consult the EPS.  This isn't perfect</span><span>
</span><span id="line-194"></span><span class="hs-comment">-- (we might conclude the module exports an instance when it doesn't, see</span><span>
</span><span id="line-195"></span><span class="hs-comment">-- #9422), but we will never refuse to compile something.</span><span>
</span><span id="line-196"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#check_inst"><span class="hs-identifier hs-type">check_inst</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.InstEnv.html#ClsInst"><span class="hs-identifier hs-type">ClsInst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-197"></span><span id="check_inst"><span class="annot"><span class="annottext">check_inst :: ClsInst -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Backpack.html#check_inst"><span class="hs-identifier hs-var hs-var">check_inst</span></a></span></span><span> </span><span id="local-6989586621681161136"><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681161136"><span class="hs-identifier hs-var">sig_inst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-198"></span><span>    </span><span class="hs-comment">-- TODO: This could be very well generalized to support instance</span><span>
</span><span id="line-199"></span><span>    </span><span class="hs-comment">-- declarations in boot files.</span><span>
</span><span id="line-200"></span><span>    </span><span id="local-6989586621681161135"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681161135"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-201"></span><span>    </span><span class="hs-comment">-- NB: Have to tug on the interface, not necessarily</span><span>
</span><span id="line-202"></span><span>    </span><span class="hs-comment">-- tugged... but it didn't work?</span><span>
</span><span id="line-203"></span><span>    </span><span class="annot"><span class="annottext">(Name -&gt; TcM (MaybeErr SDoc TyThing)) -&gt; [Name] -&gt; TcRn ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM (MaybeErr SDoc TyThing)
</span><a href="GHC.Iface.Load.html#tcLookupImported_maybe"><span class="hs-identifier hs-var">tcLookupImported_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NameSet -&gt; [Name]
</span><a href="GHC.Types.Name.Set.html#nameSetElemsStable"><span class="hs-identifier hs-var">nameSetElemsStable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClsInst -&gt; NameSet
</span><a href="GHC.Core.InstEnv.html#orphNamesOfClsInst"><span class="hs-identifier hs-var">orphNamesOfClsInst</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681161136"><span class="hs-identifier hs-var">sig_inst</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-204"></span><span>    </span><span class="hs-comment">-- Based off of 'simplifyDeriv'</span><span>
</span><span id="line-205"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681161132"><span class="annot"><span class="annottext">ty :: Kind
</span><a href="#local-6989586621681161132"><span class="hs-identifier hs-var hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClsInst -&gt; Id
</span><a href="GHC.Core.InstEnv.html#instanceDFunId"><span class="hs-identifier hs-var">instanceDFunId</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681161136"><span class="hs-identifier hs-var">sig_inst</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-206"></span><span>        </span><span id="local-6989586621681161129"><span class="annot"><span class="annottext">skol_info :: SkolemInfo
</span><a href="#local-6989586621681161129"><span class="hs-identifier hs-var hs-var">skol_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SkolemInfo
</span><a href="GHC.Tc.Types.Origin.html#InstSkol"><span class="hs-identifier hs-var">InstSkol</span></a></span><span>
</span><span id="line-207"></span><span>        </span><span class="hs-comment">-- Based off of tcSplitDFunTy</span><span>
</span><span id="line-208"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681161127"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681161127"><span class="hs-identifier hs-var">tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681161126"><span class="annot"><span class="annottext">[Scaled Kind]
</span><a href="#local-6989586621681161126"><span class="hs-identifier hs-var">theta</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681161125"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681161125"><span class="hs-identifier hs-var">pred</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-209"></span><span>           </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; ([Id], Kind)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTys"><span class="hs-identifier hs-var">tcSplitForAllTys</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681161132"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681161123"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681161123"><span class="hs-identifier hs-var">tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681161122"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681161122"><span class="hs-identifier hs-var">rho</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-210"></span><span>           </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; ([Scaled Kind], Kind)
</span><a href="GHC.Core.Type.html#splitFunTys"><span class="hs-identifier hs-var">splitFunTys</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681161122"><span class="hs-identifier hs-var">rho</span></a></span><span>     </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681161120"><span class="annot"><span class="annottext">[Scaled Kind]
</span><a href="#local-6989586621681161120"><span class="hs-identifier hs-var">theta</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681161119"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681161119"><span class="hs-identifier hs-var">pred</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-211"></span><span>           </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681161123"><span class="hs-identifier hs-var">tvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Scaled Kind]
</span><a href="#local-6989586621681161120"><span class="hs-identifier hs-var">theta</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681161119"><span class="hs-identifier hs-var">pred</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span class="hs-special">}</span><span>
</span><span id="line-212"></span><span>        </span><span id="local-6989586621681161118"><span class="annot"><span class="annottext">origin :: CtOrigin
</span><a href="#local-6989586621681161118"><span class="hs-identifier hs-var hs-var">origin</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; ClsInst -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#InstProvidedOrigin"><span class="hs-identifier hs-var">InstProvidedOrigin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_semantic_mod"><span class="hs-identifier hs-var hs-var">tcg_semantic_mod</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681161135"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681161136"><span class="hs-identifier hs-var">sig_inst</span></a></span><span>
</span><span id="line-213"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681161115"><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681161115"><span class="hs-identifier hs-var">skol_subst</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681161114"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681161114"><span class="hs-identifier hs-var">tvs_skols</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; TcM (TCvSubst, [Id])
</span><a href="GHC.Tc.Utils.Instantiate.html#tcInstSkolTyVars"><span class="hs-identifier hs-var">tcInstSkolTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681161127"><span class="hs-identifier hs-var">tvs</span></a></span><span> </span><span class="hs-comment">-- Skolemize</span><span>
</span><span id="line-214"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681161112"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621681161112"><span class="hs-identifier hs-var">tclvl</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681161111"><span class="annot"><span class="annottext">[CtEvidence]
</span><a href="#local-6989586621681161111"><span class="hs-identifier hs-var">cts</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM [CtEvidence] -&gt; TcM (TcLevel, [CtEvidence])
forall a. TcM a -&gt; TcM (TcLevel, a)
</span><a href="GHC.Tc.Utils.Monad.html#pushTcLevelM"><span class="hs-identifier hs-var">pushTcLevelM</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM [CtEvidence] -&gt; TcM (TcLevel, [CtEvidence]))
-&gt; TcM [CtEvidence] -&gt; TcM (TcLevel, [CtEvidence])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-215"></span><span>       </span><span id="local-6989586621681161109"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621681161109"><span class="hs-identifier hs-var">wanted</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; Maybe TypeOrKind -&gt; Kind -&gt; TcM CtEvidence
</span><a href="GHC.Tc.Utils.TcMType.html#newWanted"><span class="hs-identifier hs-var">newWanted</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681161118"><span class="hs-identifier hs-var">origin</span></a></span><span>
</span><span id="line-216"></span><span>                           </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TypeOrKind -&gt; Maybe TypeOrKind
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">TypeOrKind
</span><a href="GHC.Types.Basic.html#TypeLevel"><span class="hs-identifier hs-var">TypeLevel</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-217"></span><span>                           </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; Kind -&gt; Kind
TCvSubst -&gt; Kind -&gt; Kind
</span><a href="GHC.Core.TyCo.Subst.html#substTy"><span class="hs-identifier hs-var">substTy</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681161115"><span class="hs-identifier hs-var">skol_subst</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681161125"><span class="hs-identifier hs-var">pred</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-218"></span><span>       </span><span id="local-6989586621681161105"><span class="annot"><span class="annottext">[CtEvidence]
</span><a href="#local-6989586621681161105"><span class="hs-identifier hs-var">givens</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Scaled Kind]
-&gt; (Scaled Kind -&gt; TcM CtEvidence) -&gt; TcM [CtEvidence]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
t a -&gt; (a -&gt; m b) -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#forM"><span class="hs-identifier hs-var">forM</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Kind]
</span><a href="#local-6989586621681161126"><span class="hs-identifier hs-var">theta</span></a></span><span> </span><span class="annot"><span class="annottext">((Scaled Kind -&gt; TcM CtEvidence) -&gt; TcM [CtEvidence])
-&gt; (Scaled Kind -&gt; TcM CtEvidence) -&gt; TcM [CtEvidence]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681161103"><span class="annot"><span class="annottext">Scaled Kind
</span><a href="#local-6989586621681161103"><span class="hs-identifier hs-var">given</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-219"></span><span>           </span><span id="local-6989586621681161102"><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621681161102"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; Maybe TypeOrKind -&gt; TcM CtLoc
</span><a href="GHC.Tc.Utils.Monad.html#getCtLocM"><span class="hs-identifier hs-var">getCtLocM</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621681161118"><span class="hs-identifier hs-var">origin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TypeOrKind -&gt; Maybe TypeOrKind
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">TypeOrKind
</span><a href="GHC.Types.Basic.html#TypeLevel"><span class="hs-identifier hs-var">TypeLevel</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span>           </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681161100"><span class="annot"><span class="annottext">given_pred :: Kind
</span><a href="#local-6989586621681161100"><span class="hs-identifier hs-var hs-var">given_pred</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; Kind -&gt; Kind
TCvSubst -&gt; Kind -&gt; Kind
</span><a href="GHC.Core.TyCo.Subst.html#substTy"><span class="hs-identifier hs-var">substTy</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681161115"><span class="hs-identifier hs-var">skol_subst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled Kind -&gt; Kind
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled Kind
</span><a href="#local-6989586621681161103"><span class="hs-identifier hs-var">given</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-221"></span><span>           </span><span id="local-6989586621681161098"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681161098"><span class="hs-identifier hs-var">new_ev</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; TcRnIf TcGblEnv TcLclEnv Id
forall gbl lcl. Kind -&gt; TcRnIf gbl lcl Id
</span><a href="GHC.Tc.Utils.TcMType.html#newEvVar"><span class="hs-identifier hs-var">newEvVar</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681161100"><span class="hs-identifier hs-var">given_pred</span></a></span><span>
</span><span id="line-222"></span><span>           </span><span class="annot"><span class="annottext">CtEvidence -&gt; TcM CtEvidence
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">CtGiven :: Kind -&gt; Id -&gt; CtLoc -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#CtGiven"><span class="hs-identifier hs-type">CtGiven</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctev_pred :: Kind
</span><a href="GHC.Tc.Types.Constraint.html#ctev_pred"><span class="hs-identifier hs-var">ctev_pred</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681161100"><span class="hs-identifier hs-var">given_pred</span></a></span><span>
</span><span id="line-223"></span><span>                          </span><span class="hs-comment">-- Doesn't matter, make something up</span><span>
</span><span id="line-224"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ctev_evar :: Id
</span><a href="GHC.Tc.Types.Constraint.html#ctev_evar"><span class="hs-identifier hs-var">ctev_evar</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681161098"><span class="hs-identifier hs-var">new_ev</span></a></span><span>
</span><span id="line-225"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ctev_loc :: CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#ctev_loc"><span class="hs-identifier hs-var">ctev_loc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621681161102"><span class="hs-identifier hs-var">loc</span></a></span><span>
</span><span id="line-226"></span><span>                          </span><span class="hs-special">}</span><span>
</span><span id="line-227"></span><span>       </span><span class="annot"><span class="annottext">[CtEvidence] -&gt; TcM [CtEvidence]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">([CtEvidence] -&gt; TcM [CtEvidence])
-&gt; [CtEvidence] -&gt; TcM [CtEvidence]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621681161109"><span class="hs-identifier hs-var">wanted</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; [CtEvidence] -&gt; [CtEvidence]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[CtEvidence]
</span><a href="#local-6989586621681161105"><span class="hs-identifier hs-var">givens</span></a></span><span>
</span><span id="line-228"></span><span>    </span><span id="local-6989586621681161092"><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621681161092"><span class="hs-identifier hs-var">unsolved</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[CtEvidence] -&gt; TcM WantedConstraints
</span><a href="GHC.Tc.Solver.html#simplifyWantedsTcM"><span class="hs-identifier hs-var">simplifyWantedsTcM</span></a></span><span> </span><span class="annot"><span class="annottext">[CtEvidence]
</span><a href="#local-6989586621681161111"><span class="hs-identifier hs-var">cts</span></a></span><span>
</span><span id="line-229"></span><span>
</span><span id="line-230"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681161090"><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621681161090"><span class="hs-identifier hs-var">implic</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcEvBinds
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcLevel
-&gt; SkolemInfo
-&gt; [Id]
-&gt; [Id]
-&gt; WantedConstraints
-&gt; TcM (Bag Implication, TcEvBinds)
</span><a href="GHC.Tc.Utils.Unify.html#buildImplicationFor"><span class="hs-identifier hs-var">buildImplicationFor</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621681161112"><span class="hs-identifier hs-var">tclvl</span></a></span><span> </span><span class="annot"><span class="annottext">SkolemInfo
</span><a href="#local-6989586621681161129"><span class="hs-identifier hs-var">skol_info</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681161114"><span class="hs-identifier hs-var">tvs_skols</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621681161092"><span class="hs-identifier hs-var">unsolved</span></a></span><span>
</span><span id="line-231"></span><span>    </span><span class="annot"><span class="annottext">WantedConstraints -&gt; TcRn ()
</span><a href="GHC.Tc.Errors.html#reportAllUnsolved"><span class="hs-identifier hs-var">reportAllUnsolved</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag Implication -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#mkImplicWC"><span class="hs-identifier hs-var">mkImplicWC</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621681161090"><span class="hs-identifier hs-var">implic</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-232"></span><span>
</span><span id="line-233"></span><span class="hs-comment">-- | Return this list of requirement interfaces that need to be merged</span><span>
</span><span id="line-234"></span><span class="hs-comment">-- to form @mod_name@, or @[]@ if this is not a requirement.</span><span>
</span><span id="line-235"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#requirementMerges"><span class="hs-identifier hs-type">requirementMerges</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.State.html#UnitState"><span class="hs-identifier hs-type">UnitState</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#InstantiatedModule"><span class="hs-identifier hs-type">InstantiatedModule</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-236"></span><span id="requirementMerges"><span class="annot"><span class="annottext">requirementMerges :: UnitState -&gt; ModuleName -&gt; [InstantiatedModule]
</span><a href="GHC.Tc.Utils.Backpack.html#requirementMerges"><span class="hs-identifier hs-var hs-var">requirementMerges</span></a></span></span><span> </span><span id="local-6989586621681161085"><span class="annot"><span class="annottext">UnitState
</span><a href="#local-6989586621681161085"><span class="hs-identifier hs-var">pkgstate</span></a></span></span><span> </span><span id="local-6989586621681161084"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161084"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-237"></span><span>    </span><span class="annot"><span class="annottext">(InstantiatedModule -&gt; InstantiatedModule)
-&gt; [InstantiatedModule] -&gt; [InstantiatedModule]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedModule -&gt; InstantiatedModule
</span><a href="#local-6989586621681161083"><span class="hs-identifier hs-var">fixupModule</span></a></span><span> </span><span class="annot"><span class="annottext">([InstantiatedModule] -&gt; [InstantiatedModule])
-&gt; [InstantiatedModule] -&gt; [InstantiatedModule]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[InstantiatedModule]
-&gt; Maybe [InstantiatedModule] -&gt; [InstantiatedModule]
forall a. a -&gt; Maybe a -&gt; a
</span><a href="../../base/src/Data.Maybe.html#fromMaybe"><span class="hs-identifier hs-var">fromMaybe</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName
-&gt; Map ModuleName [InstantiatedModule]
-&gt; Maybe [InstantiatedModule]
forall k a. Ord k =&gt; k -&gt; Map k a -&gt; Maybe a
</span><a href="../../containers/src/Data.Map.Internal.html#lookup"><span class="hs-identifier hs-var">Map.lookup</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161084"><span class="hs-identifier hs-var">mod_name</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnitState -&gt; Map ModuleName [InstantiatedModule]
</span><a href="GHC.Unit.State.html#requirementContext"><span class="hs-identifier hs-var hs-var">requirementContext</span></a></span><span> </span><span class="annot"><span class="annottext">UnitState
</span><a href="#local-6989586621681161085"><span class="hs-identifier hs-var">pkgstate</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-238"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-239"></span><span>      </span><span class="hs-comment">-- update IndefUnitId ppr info as they may have changed since the</span><span>
</span><span id="line-240"></span><span>      </span><span class="hs-comment">-- time the IndefUnitId was created</span><span>
</span><span id="line-241"></span><span>      </span><span id="local-6989586621681161083"><span class="annot"><span class="annottext">fixupModule :: InstantiatedModule -&gt; InstantiatedModule
</span><a href="#local-6989586621681161083"><span class="hs-identifier hs-var hs-var">fixupModule</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span id="local-6989586621681161078"><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681161078"><span class="hs-identifier hs-var">iud</span></a></span></span><span> </span><span id="local-6989586621681161077"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161077"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit -&gt; ModuleName -&gt; InstantiatedModule
forall unit. unit -&gt; ModuleName -&gt; GenModule unit
</span><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-var">Module</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681161076"><span class="hs-identifier hs-var">iud'</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161077"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-242"></span><span>         </span><span class="hs-keyword">where</span><span>
</span><span id="line-243"></span><span>            </span><span id="local-6989586621681161076"><span class="annot"><span class="annottext">iud' :: InstantiatedUnit
</span><a href="#local-6989586621681161076"><span class="hs-identifier hs-var hs-var">iud'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681161078"><span class="hs-identifier hs-var">iud</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">instUnitInstanceOf :: Indefinite UnitId
</span><a href="GHC.Unit.Types.html#instUnitInstanceOf"><span class="hs-identifier hs-var">instUnitInstanceOf</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Indefinite UnitId
</span><a href="#local-6989586621681161074"><span class="hs-identifier hs-var">cid'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-244"></span><span>            </span><span id="local-6989586621681161073"><span class="annot"><span class="annottext">cid :: Indefinite UnitId
</span><a href="#local-6989586621681161073"><span class="hs-identifier hs-var hs-var">cid</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit -&gt; Indefinite UnitId
forall unit. GenInstantiatedUnit unit -&gt; Indefinite unit
</span><a href="GHC.Unit.Types.html#instUnitInstanceOf"><span class="hs-identifier hs-var hs-var">instUnitInstanceOf</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681161078"><span class="hs-identifier hs-var">iud</span></a></span><span>
</span><span id="line-245"></span><span>            </span><span id="local-6989586621681161074"><span class="annot"><span class="annottext">cid' :: Indefinite UnitId
</span><a href="#local-6989586621681161074"><span class="hs-identifier hs-var hs-var">cid'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnitState -&gt; Indefinite UnitId -&gt; Indefinite UnitId
</span><a href="GHC.Unit.State.html#updateIndefUnitId"><span class="hs-identifier hs-var">updateIndefUnitId</span></a></span><span> </span><span class="annot"><span class="annottext">UnitState
</span><a href="#local-6989586621681161085"><span class="hs-identifier hs-var">pkgstate</span></a></span><span> </span><span class="annot"><span class="annottext">Indefinite UnitId
</span><a href="#local-6989586621681161073"><span class="hs-identifier hs-var">cid</span></a></span><span>
</span><span id="line-246"></span><span>
</span><span id="line-247"></span><span class="hs-comment">-- | For a module @modname@ of type 'HscSource', determine the list</span><span>
</span><span id="line-248"></span><span class="hs-comment">-- of extra &quot;imports&quot; of other requirements which should be considered part of</span><span>
</span><span id="line-249"></span><span class="hs-comment">-- the import of the requirement, because it transitively depends on those</span><span>
</span><span id="line-250"></span><span class="hs-comment">-- requirements by imports of modules from other packages.  The situation</span><span>
</span><span id="line-251"></span><span class="hs-comment">-- is something like this:</span><span>
</span><span id="line-252"></span><span class="hs-comment">--</span><span>
</span><span id="line-253"></span><span class="hs-comment">--      unit p where</span><span>
</span><span id="line-254"></span><span class="hs-comment">--          signature A</span><span>
</span><span id="line-255"></span><span class="hs-comment">--          signature B</span><span>
</span><span id="line-256"></span><span class="hs-comment">--              import A</span><span>
</span><span id="line-257"></span><span class="hs-comment">--</span><span>
</span><span id="line-258"></span><span class="hs-comment">--      unit q where</span><span>
</span><span id="line-259"></span><span class="hs-comment">--          dependency p[A=\&lt;A&gt;,B=\&lt;B&gt;]</span><span>
</span><span id="line-260"></span><span class="hs-comment">--          signature A</span><span>
</span><span id="line-261"></span><span class="hs-comment">--          signature B</span><span>
</span><span id="line-262"></span><span class="hs-comment">--</span><span>
</span><span id="line-263"></span><span class="hs-comment">-- Although q's B does not directly import A, we still have to make sure we</span><span>
</span><span id="line-264"></span><span class="hs-comment">-- process A first, because the merging process will cause B to indirectly</span><span>
</span><span id="line-265"></span><span class="hs-comment">-- import A.  This function finds the TRANSITIVE closure of all such imports</span><span>
</span><span id="line-266"></span><span class="hs-comment">-- we need to make.</span><span>
</span><span id="line-267"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#findExtraSigImports%27"><span class="hs-identifier hs-type">findExtraSigImports'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span>
</span><span id="line-268"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Phases.html#HscSource"><span class="hs-identifier hs-type">HscSource</span></a></span><span>
</span><span id="line-269"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span>
</span><span id="line-270"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.DSet.html#UniqDSet"><span class="hs-identifier hs-type">UniqDSet</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-271"></span><span id="findExtraSigImports%27"><span class="annot"><span class="annottext">findExtraSigImports' :: HscEnv -&gt; HscSource -&gt; ModuleName -&gt; IO (UniqDSet ModuleName)
</span><a href="GHC.Tc.Utils.Backpack.html#findExtraSigImports%27"><span class="hs-identifier hs-var hs-var">findExtraSigImports'</span></a></span></span><span> </span><span id="local-6989586621681161071"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161071"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span class="annot"><span class="annottext">HscSource
</span><a href="GHC.Driver.Phases.html#HsigFile"><span class="hs-identifier hs-var">HsigFile</span></a></span><span> </span><span id="local-6989586621681161069"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161069"><span class="hs-identifier hs-var">modname</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-272"></span><span>    </span><span class="annot"><span class="annottext">([UniqDSet ModuleName] -&gt; UniqDSet ModuleName)
-&gt; IO [UniqDSet ModuleName] -&gt; IO (UniqDSet ModuleName)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">[UniqDSet ModuleName] -&gt; UniqDSet ModuleName
forall a. [UniqDSet a] -&gt; UniqDSet a
</span><a href="GHC.Types.Unique.DSet.html#unionManyUniqDSets"><span class="hs-identifier hs-var">unionManyUniqDSets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[InstantiatedModule]
-&gt; (InstantiatedModule -&gt; IO (UniqDSet ModuleName))
-&gt; IO [UniqDSet ModuleName]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
t a -&gt; (a -&gt; m b) -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#forM"><span class="hs-identifier hs-var">forM</span></a></span><span> </span><span class="annot"><span class="annottext">[InstantiatedModule]
</span><a href="#local-6989586621681161067"><span class="hs-identifier hs-var">reqs</span></a></span><span> </span><span class="annot"><span class="annottext">((InstantiatedModule -&gt; IO (UniqDSet ModuleName))
 -&gt; IO [UniqDSet ModuleName])
-&gt; (InstantiatedModule -&gt; IO (UniqDSet ModuleName))
-&gt; IO [UniqDSet ModuleName]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span id="local-6989586621681161066"><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681161066"><span class="hs-identifier hs-var">iuid</span></a></span></span><span> </span><span id="local-6989586621681161065"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161065"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-273"></span><span>        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; IfG (UniqDSet ModuleName) -&gt; IO (UniqDSet ModuleName)
forall a. HscEnv -&gt; IfG a -&gt; IO a
</span><a href="GHC.Tc.Utils.Monad.html#initIfaceLoad"><span class="hs-identifier hs-var">initIfaceLoad</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161071"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-274"></span><span>            </span><span class="annot"><span class="annottext">(IfG (UniqDSet ModuleName) -&gt; IO (UniqDSet ModuleName))
-&gt; (TcRnIf IfGblEnv () (MaybeErr SDoc (UniqDSet ModuleName))
    -&gt; IfG (UniqDSet ModuleName))
-&gt; TcRnIf IfGblEnv () (MaybeErr SDoc (UniqDSet ModuleName))
-&gt; IO (UniqDSet ModuleName)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">TcRnIf IfGblEnv () (MaybeErr SDoc (UniqDSet ModuleName))
-&gt; IfG (UniqDSet ModuleName)
forall gbl lcl a.
TcRnIf gbl lcl (MaybeErr SDoc a) -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#withException"><span class="hs-identifier hs-var">withException</span></a></span><span>
</span><span id="line-275"></span><span>            </span><span class="annot"><span class="annottext">(TcRnIf IfGblEnv () (MaybeErr SDoc (UniqDSet ModuleName))
 -&gt; IO (UniqDSet ModuleName))
-&gt; TcRnIf IfGblEnv () (MaybeErr SDoc (UniqDSet ModuleName))
-&gt; IO (UniqDSet ModuleName)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
-&gt; Module
-&gt; TcRnIf IfGblEnv () (MaybeErr SDoc (UniqDSet ModuleName))
forall gbl lcl.
SDoc
-&gt; Module -&gt; TcRnIf gbl lcl (MaybeErr SDoc (UniqDSet ModuleName))
</span><a href="GHC.Iface.Load.html#moduleFreeHolesPrecise"><span class="hs-identifier hs-var">moduleFreeHolesPrecise</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;findExtraSigImports&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-276"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unit -&gt; ModuleName -&gt; Module
forall unit. unit -&gt; ModuleName -&gt; GenModule unit
</span><a href="GHC.Unit.Types.html#mkModule"><span class="hs-identifier hs-var">mkModule</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InstantiatedUnit -&gt; Unit
forall uid. GenInstantiatedUnit uid -&gt; GenUnit uid
</span><a href="GHC.Unit.Types.html#VirtUnit"><span class="hs-identifier hs-var">VirtUnit</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681161066"><span class="hs-identifier hs-var">iuid</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161065"><span class="hs-identifier hs-var">mod_name</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-277"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-278"></span><span>    </span><span id="local-6989586621681161059"><span class="annot"><span class="annottext">pkgstate :: UnitState
</span><a href="#local-6989586621681161059"><span class="hs-identifier hs-var hs-var">pkgstate</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; UnitState
</span><a href="GHC.Driver.Session.html#unitState"><span class="hs-identifier hs-var hs-var">unitState</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161071"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-279"></span><span>    </span><span id="local-6989586621681161067"><span class="annot"><span class="annottext">reqs :: [InstantiatedModule]
</span><a href="#local-6989586621681161067"><span class="hs-identifier hs-var hs-var">reqs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnitState -&gt; ModuleName -&gt; [InstantiatedModule]
</span><a href="GHC.Tc.Utils.Backpack.html#requirementMerges"><span class="hs-identifier hs-var">requirementMerges</span></a></span><span> </span><span class="annot"><span class="annottext">UnitState
</span><a href="#local-6989586621681161059"><span class="hs-identifier hs-var">pkgstate</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161069"><span class="hs-identifier hs-var">modname</span></a></span><span>
</span><span id="line-280"></span><span>
</span><span id="line-281"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#findExtraSigImports%27"><span class="hs-identifier hs-var">findExtraSigImports'</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">HscSource
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqDSet ModuleName -&gt; IO (UniqDSet ModuleName)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDSet ModuleName
forall a. UniqDSet a
</span><a href="GHC.Types.Unique.DSet.html#emptyUniqDSet"><span class="hs-identifier hs-var">emptyUniqDSet</span></a></span><span>
</span><span id="line-282"></span><span>
</span><span id="line-283"></span><span class="hs-comment">-- | 'findExtraSigImports', but in a convenient form for &quot;GHC.Driver.Make&quot; and</span><span>
</span><span id="line-284"></span><span class="hs-comment">-- &quot;GHC.Tc.Module&quot;.</span><span>
</span><span id="line-285"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#findExtraSigImports"><span class="hs-identifier hs-type">findExtraSigImports</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Phases.html#HscSource"><span class="hs-identifier hs-type">HscSource</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span>
</span><span id="line-286"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier hs-type">FastString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-287"></span><span id="findExtraSigImports"><span class="annot"><span class="annottext">findExtraSigImports :: HscEnv
-&gt; HscSource
-&gt; ModuleName
-&gt; IO [(Maybe FastString, Located ModuleName)]
</span><a href="GHC.Tc.Utils.Backpack.html#findExtraSigImports"><span class="hs-identifier hs-var hs-var">findExtraSigImports</span></a></span></span><span> </span><span id="local-6989586621681161055"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161055"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681161054"><span class="annot"><span class="annottext">HscSource
</span><a href="#local-6989586621681161054"><span class="hs-identifier hs-var">hsc_src</span></a></span></span><span> </span><span id="local-6989586621681161053"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161053"><span class="hs-identifier hs-var">modname</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-288"></span><span>    </span><span id="local-6989586621681161052"><span class="annot"><span class="annottext">UniqDSet ModuleName
</span><a href="#local-6989586621681161052"><span class="hs-identifier hs-var">extra_requirements</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; HscSource -&gt; ModuleName -&gt; IO (UniqDSet ModuleName)
</span><a href="GHC.Tc.Utils.Backpack.html#findExtraSigImports%27"><span class="hs-identifier hs-var">findExtraSigImports'</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161055"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">HscSource
</span><a href="#local-6989586621681161054"><span class="hs-identifier hs-var">hsc_src</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161053"><span class="hs-identifier hs-var">modname</span></a></span><span>
</span><span id="line-289"></span><span>    </span><span class="annot"><span class="annottext">[(Maybe FastString, Located ModuleName)]
-&gt; IO [(Maybe FastString, Located ModuleName)]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe FastString
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; Located ModuleName
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161050"><span class="hs-identifier hs-var">mod_name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-290"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681161050"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161050"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UniqDSet ModuleName -&gt; [ModuleName]
forall a. UniqDSet a -&gt; [a]
</span><a href="GHC.Types.Unique.DSet.html#uniqDSetToList"><span class="hs-identifier hs-var">uniqDSetToList</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDSet ModuleName
</span><a href="#local-6989586621681161052"><span class="hs-identifier hs-var">extra_requirements</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-291"></span><span>
</span><span id="line-292"></span><span class="hs-comment">-- A version of 'implicitRequirements'' which is more friendly</span><span>
</span><span id="line-293"></span><span class="hs-comment">-- for &quot;GHC.Driver.Make&quot; and &quot;GHC.Tc.Module&quot;.</span><span>
</span><span id="line-294"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#implicitRequirements"><span class="hs-identifier hs-type">implicitRequirements</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span>
</span><span id="line-295"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier hs-type">FastString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-296"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier hs-type">FastString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-297"></span><span id="implicitRequirements"><span class="annot"><span class="annottext">implicitRequirements :: HscEnv
-&gt; [(Maybe FastString, Located ModuleName)]
-&gt; IO [(Maybe FastString, Located ModuleName)]
</span><a href="GHC.Tc.Utils.Backpack.html#implicitRequirements"><span class="hs-identifier hs-var hs-var">implicitRequirements</span></a></span></span><span> </span><span id="local-6989586621681161048"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161048"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681161047"><span class="annot"><span class="annottext">[(Maybe FastString, Located ModuleName)]
</span><a href="#local-6989586621681161047"><span class="hs-identifier hs-var">normal_imports</span></a></span></span><span>
</span><span id="line-298"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681161046"><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681161046"><span class="hs-identifier hs-var">mns</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv
-&gt; [(Maybe FastString, Located ModuleName)] -&gt; IO [ModuleName]
</span><a href="GHC.Tc.Utils.Backpack.html#implicitRequirements%27"><span class="hs-identifier hs-var">implicitRequirements'</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161048"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">[(Maybe FastString, Located ModuleName)]
</span><a href="#local-6989586621681161047"><span class="hs-identifier hs-var">normal_imports</span></a></span><span>
</span><span id="line-299"></span><span>       </span><span class="annot"><span class="annottext">[(Maybe FastString, Located ModuleName)]
-&gt; IO [(Maybe FastString, Located ModuleName)]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe FastString
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; Located ModuleName
forall e. e -&gt; Located e
</span><a href="GHC.Types.SrcLoc.html#noLoc"><span class="hs-identifier hs-var">noLoc</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161045"><span class="hs-identifier hs-var">mn</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681161045"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161045"><span class="hs-identifier hs-var">mn</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681161046"><span class="hs-identifier hs-var">mns</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-300"></span><span>
</span><span id="line-301"></span><span class="hs-comment">-- Given a list of 'import M' statements in a module, figure out</span><span>
</span><span id="line-302"></span><span class="hs-comment">-- any extra implicit requirement imports they may have.  For</span><span>
</span><span id="line-303"></span><span class="hs-comment">-- example, if they 'import M' and M resolves to p[A=&lt;B&gt;], then</span><span>
</span><span id="line-304"></span><span class="hs-comment">-- they actually also import the local requirement B.</span><span>
</span><span id="line-305"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#implicitRequirements%27"><span class="hs-identifier hs-type">implicitRequirements'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span>
</span><span id="line-306"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier hs-type">FastString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-307"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-308"></span><span id="implicitRequirements%27"><span class="annot"><span class="annottext">implicitRequirements' :: HscEnv
-&gt; [(Maybe FastString, Located ModuleName)] -&gt; IO [ModuleName]
</span><a href="GHC.Tc.Utils.Backpack.html#implicitRequirements%27"><span class="hs-identifier hs-var hs-var">implicitRequirements'</span></a></span></span><span> </span><span id="local-6989586621681161044"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161044"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681161043"><span class="annot"><span class="annottext">[(Maybe FastString, Located ModuleName)]
</span><a href="#local-6989586621681161043"><span class="hs-identifier hs-var">normal_imports</span></a></span></span><span>
</span><span id="line-309"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([[ModuleName]] -&gt; [ModuleName])
-&gt; IO [[ModuleName]] -&gt; IO [ModuleName]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">[[ModuleName]] -&gt; [ModuleName]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">(IO [[ModuleName]] -&gt; IO [ModuleName])
-&gt; IO [[ModuleName]] -&gt; IO [ModuleName]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-310"></span><span>    </span><span class="annot"><span class="annottext">[(Maybe FastString, Located ModuleName)]
-&gt; ((Maybe FastString, Located ModuleName) -&gt; IO [ModuleName])
-&gt; IO [[ModuleName]]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
t a -&gt; (a -&gt; m b) -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#forM"><span class="hs-identifier hs-var">forM</span></a></span><span> </span><span class="annot"><span class="annottext">[(Maybe FastString, Located ModuleName)]
</span><a href="#local-6989586621681161043"><span class="hs-identifier hs-var">normal_imports</span></a></span><span> </span><span class="annot"><span class="annottext">(((Maybe FastString, Located ModuleName) -&gt; IO [ModuleName])
 -&gt; IO [[ModuleName]])
-&gt; ((Maybe FastString, Located ModuleName) -&gt; IO [ModuleName])
-&gt; IO [[ModuleName]]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621681161041"><span class="annot"><span class="annottext">Maybe FastString
</span><a href="#local-6989586621681161041"><span class="hs-identifier hs-var">mb_pkg</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681161040"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161040"><span class="hs-identifier hs-var">imp</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-311"></span><span>        </span><span id="local-6989586621681161039"><span class="annot"><span class="annottext">FindResult
</span><a href="#local-6989586621681161039"><span class="hs-identifier hs-var">found</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; ModuleName -&gt; Maybe FastString -&gt; IO FindResult
</span><a href="GHC.Driver.Finder.html#findImportedModule"><span class="hs-identifier hs-var">findImportedModule</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161044"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161040"><span class="hs-identifier hs-var">imp</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe FastString
</span><a href="#local-6989586621681161041"><span class="hs-identifier hs-var">mb_pkg</span></a></span><span>
</span><span id="line-312"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">FindResult
</span><a href="#local-6989586621681161039"><span class="hs-identifier hs-var">found</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-313"></span><span>            </span><span class="annot"><a href="GHC.Driver.Types.html#Found"><span class="hs-identifier hs-type">Found</span></a></span><span> </span><span class="annot"><span class="annottext">ModLocation
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681161036"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681161036"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Module -&gt; Bool
</span><a href="GHC.Driver.Session.html#isHomeModule"><span class="hs-identifier hs-var">isHomeModule</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681161033"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681161036"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-314"></span><span>                </span><span class="annot"><span class="annottext">[ModuleName] -&gt; IO [ModuleName]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqDSet ModuleName -&gt; [ModuleName]
forall a. UniqDSet a -&gt; [a]
</span><a href="GHC.Types.Unique.DSet.html#uniqDSetToList"><span class="hs-identifier hs-var">uniqDSetToList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; UniqDSet ModuleName
forall u. GenModule (GenUnit u) -&gt; UniqDSet ModuleName
</span><a href="GHC.Unit.Types.html#moduleFreeHoles"><span class="hs-identifier hs-var">moduleFreeHoles</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681161036"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-315"></span><span>            </span><span class="annot"><span class="annottext">FindResult
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[ModuleName] -&gt; IO [ModuleName]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-316"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681161033"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681161033"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161044"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-317"></span><span>
</span><span id="line-318"></span><span class="hs-comment">-- | Given a 'Unit', make sure it is well typed.  This is because</span><span>
</span><span id="line-319"></span><span class="hs-comment">-- unit IDs come from Cabal, which does not know if things are well-typed or</span><span>
</span><span id="line-320"></span><span class="hs-comment">-- not; a component may have been filled with implementations for the holes</span><span>
</span><span id="line-321"></span><span class="hs-comment">-- that don't actually fulfill the requirements.</span><span>
</span><span id="line-322"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#checkUnit"><span class="hs-identifier hs-type">checkUnit</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Unit"><span class="hs-identifier hs-type">Unit</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-323"></span><span id="checkUnit"><span class="annot"><span class="annottext">checkUnit :: Unit -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Backpack.html#checkUnit"><span class="hs-identifier hs-var hs-var">checkUnit</span></a></span></span><span> </span><span class="annot"><span class="annottext">Unit
</span><a href="GHC.Unit.Types.html#HoleUnit"><span class="hs-identifier hs-var">HoleUnit</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-324"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#checkUnit"><span class="hs-identifier hs-var">checkUnit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#RealUnit"><span class="hs-identifier hs-type">RealUnit</span></a></span><span> </span><span class="annot"><span class="annottext">Definite UnitId
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- if it's already compiled, must be well-typed</span><span>
</span><span id="line-325"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#checkUnit"><span class="hs-identifier hs-var">checkUnit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#VirtUnit"><span class="hs-identifier hs-type">VirtUnit</span></a></span><span> </span><span id="local-6989586621681161029"><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681161029"><span class="hs-identifier hs-var">indef</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-326"></span><span>   </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681161028"><span class="annot"><span class="annottext">insts :: GenInstantiations UnitId
</span><a href="#local-6989586621681161028"><span class="hs-identifier hs-var hs-var">insts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit -&gt; GenInstantiations UnitId
forall unit. GenInstantiatedUnit unit -&gt; GenInstantiations unit
</span><a href="GHC.Unit.Types.html#instUnitInsts"><span class="hs-identifier hs-var hs-var">instUnitInsts</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681161029"><span class="hs-identifier hs-var">indef</span></a></span><span>
</span><span id="line-327"></span><span>   </span><span class="annot"><span class="annottext">GenInstantiations UnitId
-&gt; ((ModuleName, Module) -&gt; TcRn ()) -&gt; TcRn ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
t a -&gt; (a -&gt; m b) -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#forM_"><span class="hs-identifier hs-var">forM_</span></a></span><span> </span><span class="annot"><span class="annottext">GenInstantiations UnitId
</span><a href="#local-6989586621681161028"><span class="hs-identifier hs-var">insts</span></a></span><span> </span><span class="annot"><span class="annottext">(((ModuleName, Module) -&gt; TcRn ()) -&gt; TcRn ())
-&gt; ((ModuleName, Module) -&gt; TcRn ()) -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621681161025"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161025"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681161024"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681161024"><span class="hs-identifier hs-var">mod</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-328"></span><span>       </span><span class="hs-comment">-- NB: direct hole instantiations are well-typed by construction</span><span>
</span><span id="line-329"></span><span>       </span><span class="hs-comment">-- (because we FORCE things to be merged in), so don't check them</span><span>
</span><span id="line-330"></span><span>       </span><span class="annot"><span class="annottext">Bool -&gt; TcRn () -&gt; TcRn ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; Bool
forall u. GenModule (GenUnit u) -&gt; Bool
</span><a href="GHC.Unit.Module.html#isHoleModule"><span class="hs-identifier hs-var">isHoleModule</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681161024"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; TcRn ()) -&gt; TcRn () -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-331"></span><span>           </span><span class="annot"><span class="annottext">Unit -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Backpack.html#checkUnit"><span class="hs-identifier hs-var">checkUnit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; Unit
forall unit. GenModule unit -&gt; unit
</span><a href="GHC.Unit.Types.html#moduleUnit"><span class="hs-identifier hs-var hs-var">moduleUnit</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681161024"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-332"></span><span>           </span><span class="annot"><span class="annottext">TcGblEnv
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681161024"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; InstantiatedModule -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
</span><a href="GHC.Tc.Utils.Backpack.html#checkImplements"><span class="hs-operator hs-var">`checkImplements`</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit -&gt; ModuleName -&gt; InstantiatedModule
forall unit. unit -&gt; ModuleName -&gt; GenModule unit
</span><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-var">Module</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681161029"><span class="hs-identifier hs-var">indef</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681161025"><span class="hs-identifier hs-var">mod_name</span></a></span><span>
</span><span id="line-333"></span><span>           </span><span class="annot"><span class="annottext">() -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-334"></span><span>
</span><span id="line-335"></span><span class="hs-comment">-- | Top-level driver for signature instantiation (run when compiling</span><span>
</span><span id="line-336"></span><span class="hs-comment">-- an @hsig@ file.)</span><span>
</span><span id="line-337"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#tcRnCheckUnit"><span class="hs-identifier hs-type">tcRnCheckUnit</span></a></span><span> </span><span class="hs-glyph">::</span><span>
</span><span id="line-338"></span><span>    </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Unit"><span class="hs-identifier hs-type">Unit</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-339"></span><span>    </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Error.html#Messages"><span class="hs-identifier hs-type">Messages</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-340"></span><span id="tcRnCheckUnit"><span class="annot"><span class="annottext">tcRnCheckUnit :: HscEnv -&gt; Unit -&gt; IO (Messages, Maybe ())
</span><a href="GHC.Tc.Utils.Backpack.html#tcRnCheckUnit"><span class="hs-identifier hs-var hs-var">tcRnCheckUnit</span></a></span></span><span> </span><span id="local-6989586621681161020"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161020"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681161019"><span class="annot"><span class="annottext">Unit
</span><a href="#local-6989586621681161019"><span class="hs-identifier hs-var">uid</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-341"></span><span>   </span><span class="annot"><span class="annottext">DynFlags
-&gt; SDoc
-&gt; ((Messages, Maybe ()) -&gt; ())
-&gt; IO (Messages, Maybe ())
-&gt; IO (Messages, Maybe ())
forall (m :: * -&gt; *) a.
MonadIO m =&gt;
DynFlags -&gt; SDoc -&gt; (a -&gt; ()) -&gt; m a -&gt; m a
</span><a href="GHC.Utils.Error.html#withTiming"><span class="hs-identifier hs-var">withTiming</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681161017"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-342"></span><span>              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Check unit id&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Unit -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Unit
</span><a href="#local-6989586621681161019"><span class="hs-identifier hs-var">uid</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-343"></span><span>              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">() -&gt; (Messages, Maybe ()) -&gt; ()
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO (Messages, Maybe ()) -&gt; IO (Messages, Maybe ()))
-&gt; IO (Messages, Maybe ()) -&gt; IO (Messages, Maybe ())
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-344"></span><span>   </span><span class="annot"><span class="annottext">HscEnv
-&gt; HscSource
-&gt; Bool
-&gt; Module
-&gt; RealSrcSpan
-&gt; TcRn ()
-&gt; IO (Messages, Maybe ())
forall r.
HscEnv
-&gt; HscSource
-&gt; Bool
-&gt; Module
-&gt; RealSrcSpan
-&gt; TcM r
-&gt; IO (Messages, Maybe r)
</span><a href="GHC.Tc.Utils.Monad.html#initTc"><span class="hs-identifier hs-var">initTc</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161020"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-345"></span><span>          </span><span class="annot"><span class="annottext">HscSource
</span><a href="GHC.Driver.Phases.html#HsigFile"><span class="hs-identifier hs-var">HsigFile</span></a></span><span> </span><span class="hs-comment">-- bogus</span><span>
</span><span id="line-346"></span><span>          </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-347"></span><span>          </span><span class="annot"><span class="annottext">Module
</span><a href="GHC.Builtin.Names.html#mAIN"><span class="hs-identifier hs-var">mAIN</span></a></span><span> </span><span class="hs-comment">-- bogus</span><span>
</span><span id="line-348"></span><span>          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealSrcLoc -&gt; RealSrcSpan
</span><a href="GHC.Types.SrcLoc.html#realSrcLocSpan"><span class="hs-identifier hs-var">realSrcLocSpan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; Int -&gt; Int -&gt; RealSrcLoc
</span><a href="GHC.Types.SrcLoc.html#mkRealSrcLoc"><span class="hs-identifier hs-var">mkRealSrcLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681161010"><span class="hs-identifier hs-var">loc_str</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- bogus</span><span>
</span><span id="line-349"></span><span>    </span><span class="annot"><span class="annottext">(TcRn () -&gt; IO (Messages, Maybe ()))
-&gt; TcRn () -&gt; IO (Messages, Maybe ())
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Unit -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Backpack.html#checkUnit"><span class="hs-identifier hs-var">checkUnit</span></a></span><span> </span><span class="annot"><span class="annottext">Unit
</span><a href="#local-6989586621681161019"><span class="hs-identifier hs-var">uid</span></a></span><span>
</span><span id="line-350"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-351"></span><span>   </span><span id="local-6989586621681161017"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681161017"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161020"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-352"></span><span>   </span><span id="local-6989586621681161010"><span class="annot"><span class="annottext">loc_str :: String
</span><a href="#local-6989586621681161010"><span class="hs-identifier hs-var hs-var">loc_str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Command line argument: -unit-id &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#showSDoc"><span class="hs-identifier hs-var">showSDoc</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681161017"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unit -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Unit
</span><a href="#local-6989586621681161019"><span class="hs-identifier hs-var">uid</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-353"></span><span>
</span><span id="line-354"></span><span class="hs-comment">-- TODO: Maybe lcl_iface0 should be pre-renamed to the right thing? Unclear...</span><span>
</span><span id="line-355"></span><span>
</span><span id="line-356"></span><span class="hs-comment">-- | Top-level driver for signature merging (run after typechecking</span><span>
</span><span id="line-357"></span><span class="hs-comment">-- an @hsig@ file).</span><span>
</span><span id="line-358"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#tcRnMergeSignatures"><span class="hs-identifier hs-type">tcRnMergeSignatures</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HsParsedModule"><span class="hs-identifier hs-type">HsParsedModule</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span> </span><span class="hs-comment">{- from local sig -}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span>
</span><span id="line-359"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Error.html#Messages"><span class="hs-identifier hs-type">Messages</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-360"></span><span id="tcRnMergeSignatures"><span class="annot"><span class="annottext">tcRnMergeSignatures :: HscEnv
-&gt; HsParsedModule
-&gt; TcGblEnv
-&gt; ModIface
-&gt; IO (Messages, Maybe TcGblEnv)
</span><a href="GHC.Tc.Utils.Backpack.html#tcRnMergeSignatures"><span class="hs-identifier hs-var hs-var">tcRnMergeSignatures</span></a></span></span><span> </span><span id="local-6989586621681161008"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161008"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681161007"><span class="annot"><span class="annottext">HsParsedModule
</span><a href="#local-6989586621681161007"><span class="hs-identifier hs-var">hpm</span></a></span></span><span> </span><span id="local-6989586621681161006"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681161006"><span class="hs-identifier hs-var">orig_tcg_env</span></a></span></span><span> </span><span id="local-6989586621681161005"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681161005"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-361"></span><span>  </span><span class="annot"><span class="annottext">DynFlags
-&gt; SDoc
-&gt; ((Messages, Maybe TcGblEnv) -&gt; ())
-&gt; IO (Messages, Maybe TcGblEnv)
-&gt; IO (Messages, Maybe TcGblEnv)
forall (m :: * -&gt; *) a.
MonadIO m =&gt;
DynFlags -&gt; SDoc -&gt; (a -&gt; ()) -&gt; m a -&gt; m a
</span><a href="GHC.Utils.Error.html#withTiming"><span class="hs-identifier hs-var">withTiming</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681161004"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-362"></span><span>             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Signature merging&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#brackets"><span class="hs-identifier hs-var">brackets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681161002"><span class="hs-identifier hs-var">this_mod</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-363"></span><span>             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">() -&gt; (Messages, Maybe TcGblEnv) -&gt; ()
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO (Messages, Maybe TcGblEnv) -&gt; IO (Messages, Maybe TcGblEnv))
-&gt; IO (Messages, Maybe TcGblEnv) -&gt; IO (Messages, Maybe TcGblEnv)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-364"></span><span>  </span><span class="annot"><span class="annottext">HscEnv
-&gt; HscSource
-&gt; Bool
-&gt; Module
-&gt; RealSrcSpan
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; IO (Messages, Maybe TcGblEnv)
forall r.
HscEnv
-&gt; HscSource
-&gt; Bool
-&gt; Module
-&gt; RealSrcSpan
-&gt; TcM r
-&gt; IO (Messages, Maybe r)
</span><a href="GHC.Tc.Utils.Monad.html#initTc"><span class="hs-identifier hs-var">initTc</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161008"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">HscSource
</span><a href="GHC.Driver.Phases.html#HsigFile"><span class="hs-identifier hs-var">HsigFile</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681161002"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621681161001"><span class="hs-identifier hs-var">real_loc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRnIf TcGblEnv TcLclEnv TcGblEnv
 -&gt; IO (Messages, Maybe TcGblEnv))
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; IO (Messages, Maybe TcGblEnv)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-365"></span><span>    </span><span class="annot"><span class="annottext">HsParsedModule
-&gt; TcGblEnv -&gt; ModIface -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
</span><a href="GHC.Tc.Utils.Backpack.html#mergeSignatures"><span class="hs-identifier hs-var">mergeSignatures</span></a></span><span> </span><span class="annot"><span class="annottext">HsParsedModule
</span><a href="#local-6989586621681161007"><span class="hs-identifier hs-var">hpm</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681161006"><span class="hs-identifier hs-var">orig_tcg_env</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681161005"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-366"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-367"></span><span>  </span><span id="local-6989586621681161004"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681161004"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681161008"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-368"></span><span>  </span><span id="local-6989586621681161002"><span class="annot"><span class="annottext">this_mod :: Module
</span><a href="#local-6989586621681161002"><span class="hs-identifier hs-var hs-var">this_mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; Module
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; Module
</span><a href="GHC.Driver.Types.html#mi_module"><span class="hs-identifier hs-var hs-var">mi_module</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681161005"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-369"></span><span>  </span><span id="local-6989586621681161001"><span class="annot"><span class="annottext">real_loc :: RealSrcSpan
</span><a href="#local-6989586621681161001"><span class="hs-identifier hs-var hs-var">real_loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; RealSrcSpan
</span><a href="GHC.Tc.Types.html#tcg_top_loc"><span class="hs-identifier hs-var hs-var">tcg_top_loc</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681161006"><span class="hs-identifier hs-var">orig_tcg_env</span></a></span><span>
</span><span id="line-370"></span><span>
</span><span id="line-371"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#thinModIface"><span class="hs-identifier hs-type">thinModIface</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span>
</span><span id="line-372"></span><span id="thinModIface"><span class="annot"><span class="annottext">thinModIface :: [AvailInfo] -&gt; ModIface -&gt; ModIface
</span><a href="GHC.Tc.Utils.Backpack.html#thinModIface"><span class="hs-identifier hs-var hs-var">thinModIface</span></a></span></span><span> </span><span id="local-6989586621681160997"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160997"><span class="hs-identifier hs-var">avails</span></a></span></span><span> </span><span id="local-6989586621681160996"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160996"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-373"></span><span>    </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160996"><span class="hs-identifier hs-var">iface</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-374"></span><span>        </span><span class="annot"><span class="annottext">mi_exports :: [AvailInfo]
</span><a href="GHC.Driver.Types.html#mi_exports"><span class="hs-identifier hs-var">mi_exports</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160997"><span class="hs-identifier hs-var">avails</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-375"></span><span>        </span><span class="hs-comment">-- mi_fixities = ...,</span><span>
</span><span id="line-376"></span><span>        </span><span class="hs-comment">-- mi_warns = ...,</span><span>
</span><span id="line-377"></span><span>        </span><span class="hs-comment">-- mi_anns = ...,</span><span>
</span><span id="line-378"></span><span>        </span><span class="hs-comment">-- TODO: The use of nameOccName here is a bit dodgy, because</span><span>
</span><span id="line-379"></span><span>        </span><span class="hs-comment">-- perhaps there might be two IfaceTopBndr that are the same</span><span>
</span><span id="line-380"></span><span>        </span><span class="hs-comment">-- OccName but different Name.  Requires better understanding</span><span>
</span><span id="line-381"></span><span>        </span><span class="hs-comment">-- of invariants here.</span><span>
</span><span id="line-382"></span><span>        </span><span class="annot"><span class="annottext">mi_decls :: [IfaceDeclExts 'ModIfaceFinal]
</span><a href="GHC.Driver.Types.html#mi_decls"><span class="hs-identifier hs-var">mi_decls</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Fingerprint, IfaceDecl)]
</span><a href="#local-6989586621681160993"><span class="hs-identifier hs-var">exported_decls</span></a></span><span> </span><span class="annot"><span class="annottext">[(Fingerprint, IfaceDecl)]
-&gt; [(Fingerprint, IfaceDecl)] -&gt; [(Fingerprint, IfaceDecl)]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[(Fingerprint, IfaceDecl)]
</span><a href="#local-6989586621681160992"><span class="hs-identifier hs-var">non_exported_decls</span></a></span><span> </span><span class="annot"><span class="annottext">[(Fingerprint, IfaceDecl)]
-&gt; [(Fingerprint, IfaceDecl)] -&gt; [(Fingerprint, IfaceDecl)]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[(Fingerprint, IfaceDecl)]
</span><a href="#local-6989586621681160991"><span class="hs-identifier hs-var">dfun_decls</span></a></span><span>
</span><span id="line-383"></span><span>        </span><span class="hs-comment">-- mi_insts = ...,</span><span>
</span><span id="line-384"></span><span>        </span><span class="hs-comment">-- mi_fam_insts = ...,</span><span>
</span><span id="line-385"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-386"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-387"></span><span>    </span><span id="local-6989586621681160990"><span class="annot"><span class="annottext">decl_pred :: OccSet -&gt; IfaceDecl -&gt; Bool
</span><a href="#local-6989586621681160990"><span class="hs-identifier hs-var hs-var">decl_pred</span></a></span></span><span> </span><span id="local-6989586621681160989"><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621681160989"><span class="hs-identifier hs-var">occs</span></a></span></span><span> </span><span id="local-6989586621681160988"><span class="annot"><span class="annottext">IfaceDecl
</span><a href="#local-6989586621681160988"><span class="hs-identifier hs-var">decl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IfaceDecl -&gt; Name
</span><a href="GHC.Iface.Syntax.html#ifName"><span class="hs-identifier hs-var hs-var">ifName</span></a></span><span> </span><span class="annot"><span class="annottext">IfaceDecl
</span><a href="#local-6989586621681160988"><span class="hs-identifier hs-var">decl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccSet -&gt; Bool
</span><a href="GHC.Types.Name.Occurrence.html#elemOccSet"><span class="hs-operator hs-var">`elemOccSet`</span></a></span><span> </span><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621681160989"><span class="hs-identifier hs-var">occs</span></a></span><span>
</span><span id="line-388"></span><span>    </span><span id="local-6989586621681160985"><span class="annot"><span class="annottext">filter_decls :: OccSet -&gt; [(Fingerprint, IfaceDecl)]
</span><a href="#local-6989586621681160985"><span class="hs-identifier hs-var hs-var">filter_decls</span></a></span></span><span> </span><span id="local-6989586621681160984"><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621681160984"><span class="hs-identifier hs-var">occs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Fingerprint, IfaceDecl) -&gt; Bool)
-&gt; [(Fingerprint, IfaceDecl)] -&gt; [(Fingerprint, IfaceDecl)]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccSet -&gt; IfaceDecl -&gt; Bool
</span><a href="#local-6989586621681160990"><span class="hs-identifier hs-var">decl_pred</span></a></span><span> </span><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621681160984"><span class="hs-identifier hs-var">occs</span></a></span><span> </span><span class="annot"><span class="annottext">(IfaceDecl -&gt; Bool)
-&gt; ((Fingerprint, IfaceDecl) -&gt; IfaceDecl)
-&gt; (Fingerprint, IfaceDecl)
-&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Fingerprint, IfaceDecl) -&gt; IfaceDecl
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; [IfaceDeclExts 'ModIfaceFinal]
forall (phase :: ModIfacePhase).
ModIface_ phase -&gt; [IfaceDeclExts phase]
</span><a href="GHC.Driver.Types.html#mi_decls"><span class="hs-identifier hs-var hs-var">mi_decls</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160996"><span class="hs-identifier hs-var">iface</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-389"></span><span>
</span><span id="line-390"></span><span>    </span><span id="local-6989586621681160983"><span class="annot"><span class="annottext">exported_occs :: OccSet
</span><a href="#local-6989586621681160983"><span class="hs-identifier hs-var hs-var">exported_occs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[OccName] -&gt; OccSet
</span><a href="GHC.Types.Name.Occurrence.html#mkOccSet"><span class="hs-identifier hs-var">mkOccSet</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681160981"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-391"></span><span>                             </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681160980"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681160980"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160997"><span class="hs-identifier hs-var">avails</span></a></span><span>
</span><span id="line-392"></span><span>                             </span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160981"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681160981"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; [Name]
</span><a href="GHC.Types.Avail.html#availNames"><span class="hs-identifier hs-var">availNames</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681160980"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-393"></span><span>    </span><span id="local-6989586621681160993"><span class="annot"><span class="annottext">exported_decls :: [(Fingerprint, IfaceDecl)]
</span><a href="#local-6989586621681160993"><span class="hs-identifier hs-var hs-var">exported_decls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccSet -&gt; [(Fingerprint, IfaceDecl)]
</span><a href="#local-6989586621681160985"><span class="hs-identifier hs-var">filter_decls</span></a></span><span> </span><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621681160983"><span class="hs-identifier hs-var">exported_occs</span></a></span><span>
</span><span id="line-394"></span><span>
</span><span id="line-395"></span><span>    </span><span id="local-6989586621681160978"><span class="annot"><span class="annottext">non_exported_occs :: OccSet
</span><a href="#local-6989586621681160978"><span class="hs-identifier hs-var hs-var">non_exported_occs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[OccName] -&gt; OccSet
</span><a href="GHC.Types.Name.Occurrence.html#mkOccSet"><span class="hs-identifier hs-var">mkOccSet</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681160977"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-396"></span><span>                                 </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Fingerprint
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160976"><span class="annot"><span class="annottext">IfaceDecl
</span><a href="#local-6989586621681160976"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Fingerprint, IfaceDecl)]
</span><a href="#local-6989586621681160993"><span class="hs-identifier hs-var">exported_decls</span></a></span><span>
</span><span id="line-397"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160977"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681160977"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IfaceDecl -&gt; [Name]
</span><a href="GHC.Tc.Utils.Backpack.html#ifaceDeclNeverExportedRefs"><span class="hs-identifier hs-var">ifaceDeclNeverExportedRefs</span></a></span><span> </span><span class="annot"><span class="annottext">IfaceDecl
</span><a href="#local-6989586621681160976"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-398"></span><span>    </span><span id="local-6989586621681160992"><span class="annot"><span class="annottext">non_exported_decls :: [(Fingerprint, IfaceDecl)]
</span><a href="#local-6989586621681160992"><span class="hs-identifier hs-var hs-var">non_exported_decls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccSet -&gt; [(Fingerprint, IfaceDecl)]
</span><a href="#local-6989586621681160985"><span class="hs-identifier hs-var">filter_decls</span></a></span><span> </span><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621681160978"><span class="hs-identifier hs-var">non_exported_occs</span></a></span><span>
</span><span id="line-399"></span><span>
</span><span id="line-400"></span><span>    </span><span id="local-6989586621681160974"><span class="annot"><span class="annottext">dfun_pred :: IfaceDecl -&gt; Bool
</span><a href="#local-6989586621681160974"><span class="hs-identifier hs-var hs-var">dfun_pred</span></a></span></span><span> </span><span class="annot"><a href="GHC.Iface.Syntax.html#IfaceId"><span class="hs-identifier hs-type">IfaceId</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ifIdDetails :: IfaceDecl -&gt; IfaceIdDetails
</span><a href="GHC.Iface.Syntax.html#ifIdDetails"><span class="hs-identifier hs-var">ifIdDetails</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IfaceIdDetails
</span><a href="GHC.Iface.Syntax.html#IfDFunId"><span class="hs-identifier hs-var">IfDFunId</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-401"></span><span>    </span><span class="annot"><a href="#local-6989586621681160974"><span class="hs-identifier hs-var">dfun_pred</span></a></span><span> </span><span class="annot"><span class="annottext">IfaceDecl
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-402"></span><span>    </span><span id="local-6989586621681160991"><span class="annot"><span class="annottext">dfun_decls :: [(Fingerprint, IfaceDecl)]
</span><a href="#local-6989586621681160991"><span class="hs-identifier hs-var hs-var">dfun_decls</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Fingerprint, IfaceDecl) -&gt; Bool)
-&gt; [(Fingerprint, IfaceDecl)] -&gt; [(Fingerprint, IfaceDecl)]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IfaceDecl -&gt; Bool
</span><a href="#local-6989586621681160974"><span class="hs-identifier hs-var">dfun_pred</span></a></span><span> </span><span class="annot"><span class="annottext">(IfaceDecl -&gt; Bool)
-&gt; ((Fingerprint, IfaceDecl) -&gt; IfaceDecl)
-&gt; (Fingerprint, IfaceDecl)
-&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Fingerprint, IfaceDecl) -&gt; IfaceDecl
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; [IfaceDeclExts 'ModIfaceFinal]
forall (phase :: ModIfacePhase).
ModIface_ phase -&gt; [IfaceDeclExts phase]
</span><a href="GHC.Driver.Types.html#mi_decls"><span class="hs-identifier hs-var hs-var">mi_decls</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160996"><span class="hs-identifier hs-var">iface</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span class="hs-comment">-- | The list of 'Name's of *non-exported* 'IfaceDecl's which this</span><span>
</span><span id="line-405"></span><span class="hs-comment">-- 'IfaceDecl' may refer to.  A non-exported 'IfaceDecl' should be kept</span><span>
</span><span id="line-406"></span><span class="hs-comment">-- after thinning if an *exported* 'IfaceDecl' (or 'mi_insts', perhaps)</span><span>
</span><span id="line-407"></span><span class="hs-comment">-- refers to it; we can't decide to keep it by looking at the exports</span><span>
</span><span id="line-408"></span><span class="hs-comment">-- of a module after thinning.  Keep this synchronized with</span><span>
</span><span id="line-409"></span><span class="hs-comment">-- 'rnIfaceDecl'.</span><span>
</span><span id="line-410"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#ifaceDeclNeverExportedRefs"><span class="hs-identifier hs-type">ifaceDeclNeverExportedRefs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Iface.Syntax.html#IfaceDecl"><span class="hs-identifier hs-type">IfaceDecl</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-411"></span><span id="ifaceDeclNeverExportedRefs"><span class="annot"><span class="annottext">ifaceDeclNeverExportedRefs :: IfaceDecl -&gt; [Name]
</span><a href="GHC.Tc.Utils.Backpack.html#ifaceDeclNeverExportedRefs"><span class="hs-identifier hs-var hs-var">ifaceDeclNeverExportedRefs</span></a></span></span><span> </span><span id="local-6989586621681160970"><span class="annot"><span class="annottext">d :: IfaceDecl
</span><a href="#local-6989586621681160970"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.Iface.Syntax.html#IfaceFamily"><span class="hs-identifier hs-type">IfaceFamily</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-412"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IfaceDecl -&gt; IfaceFamTyConFlav
</span><a href="GHC.Iface.Syntax.html#ifFamFlav"><span class="hs-identifier hs-var hs-var">ifFamFlav</span></a></span><span> </span><span class="annot"><span class="annottext">IfaceDecl
</span><a href="#local-6989586621681160970"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-413"></span><span>        </span><span class="annot"><a href="GHC.Iface.Syntax.html#IfaceClosedSynFamilyTyCon"><span class="hs-identifier hs-type">IfaceClosedSynFamilyTyCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681160966"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681160966"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[IfaceAxBranch]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-414"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681160966"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-415"></span><span>        </span><span class="annot"><span class="annottext">IfaceFamTyConFlav
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-416"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#ifaceDeclNeverExportedRefs"><span class="hs-identifier hs-var">ifaceDeclNeverExportedRefs</span></a></span><span> </span><span class="annot"><span class="annottext">IfaceDecl
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-417"></span><span>
</span><span id="line-418"></span><span>
</span><span id="line-419"></span><span class="hs-comment">-- Note [Blank hsigs for all requirements]</span><span>
</span><span id="line-420"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-421"></span><span class="hs-comment">-- One invariant that a client of GHC must uphold is that there</span><span>
</span><span id="line-422"></span><span class="hs-comment">-- must be an hsig file for every requirement (according to</span><span>
</span><span id="line-423"></span><span class="hs-comment">-- @-this-unit-id@); this ensures that for every interface</span><span>
</span><span id="line-424"></span><span class="hs-comment">-- file (hi), there is a source file (hsig), which helps grease</span><span>
</span><span id="line-425"></span><span class="hs-comment">-- the wheels of recompilation avoidance which assumes that</span><span>
</span><span id="line-426"></span><span class="hs-comment">-- source files always exist.</span><span>
</span><span id="line-427"></span><span>
</span><span id="line-428"></span><span class="hs-comment">{-
inheritedSigPvpWarning :: WarningTxt
inheritedSigPvpWarning =
    WarningTxt (noLoc NoSourceText) [noLoc (StringLiteral NoSourceText (fsLit msg))]
  where
    msg = &quot;Inherited requirements from non-signature libraries (libraries &quot; ++
          &quot;with modules) should not be used, as this mode of use is not &quot; ++
          &quot;compatible with PVP-style version bounds.  Instead, copy the &quot; ++
          &quot;declaration to the local hsig file or move the signature to a &quot; ++
          &quot;library of its own and add that library as a dependency.&quot;
-}</span><span>
</span><span id="line-439"></span><span>
</span><span id="line-440"></span><span class="hs-comment">-- Note [Handling never-exported TyThings under Backpack]</span><span>
</span><span id="line-441"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-442"></span><span class="hs-comment">--   DEFINITION: A &quot;never-exported TyThing&quot; is a TyThing whose 'Name' will</span><span>
</span><span id="line-443"></span><span class="hs-comment">--   never be mentioned in the export list of a module (mi_avails).</span><span>
</span><span id="line-444"></span><span class="hs-comment">--   Unlike implicit TyThings (Note [Implicit TyThings]), non-exported</span><span>
</span><span id="line-445"></span><span class="hs-comment">--   TyThings DO have a standalone IfaceDecl declaration in their</span><span>
</span><span id="line-446"></span><span class="hs-comment">--   interface file.</span><span>
</span><span id="line-447"></span><span class="hs-comment">--</span><span>
</span><span id="line-448"></span><span class="hs-comment">-- Originally, Backpack was designed under the assumption that anything</span><span>
</span><span id="line-449"></span><span class="hs-comment">-- you could declare in a module could also be exported; thus, merging</span><span>
</span><span id="line-450"></span><span class="hs-comment">-- the export lists of two signatures is just merging the declarations</span><span>
</span><span id="line-451"></span><span class="hs-comment">-- of two signatures writ small.  Of course, in GHC Haskell, there are a</span><span>
</span><span id="line-452"></span><span class="hs-comment">-- few important things which are not explicitly exported but still can</span><span>
</span><span id="line-453"></span><span class="hs-comment">-- be used:  in particular, dictionary functions for instances, Typeable</span><span>
</span><span id="line-454"></span><span class="hs-comment">-- TyCon bindings, and coercion axioms for type families also count.</span><span>
</span><span id="line-455"></span><span class="hs-comment">--</span><span>
</span><span id="line-456"></span><span class="hs-comment">-- When handling these non-exported things, there two primary things</span><span>
</span><span id="line-457"></span><span class="hs-comment">-- we need to watch out for:</span><span>
</span><span id="line-458"></span><span class="hs-comment">--</span><span>
</span><span id="line-459"></span><span class="hs-comment">--  * Signature matching/merging is done by comparing each</span><span>
</span><span id="line-460"></span><span class="hs-comment">--    of the exported entities of a signature and a module.  These exported</span><span>
</span><span id="line-461"></span><span class="hs-comment">--    entities may refer to non-exported TyThings which must be tested for</span><span>
</span><span id="line-462"></span><span class="hs-comment">--    consistency.  For example, an instance (ClsInst) will refer to a</span><span>
</span><span id="line-463"></span><span class="hs-comment">--    non-exported DFunId.  In this case, 'checkBootDeclM' directly compares the</span><span>
</span><span id="line-464"></span><span class="hs-comment">--    embedded 'DFunId' in 'is_dfun'.</span><span>
</span><span id="line-465"></span><span class="hs-comment">--</span><span>
</span><span id="line-466"></span><span class="hs-comment">--    For this to work at all, we must ensure that pointers in 'is_dfun' refer</span><span>
</span><span id="line-467"></span><span class="hs-comment">--    to DISTINCT 'DFunId's, even though the 'Name's (may) be the same.</span><span>
</span><span id="line-468"></span><span class="hs-comment">--    Unfortunately, this is the OPPOSITE of how we treat most other references</span><span>
</span><span id="line-469"></span><span class="hs-comment">--    to 'Name's, so this case needs to be handled specially.</span><span>
</span><span id="line-470"></span><span class="hs-comment">--</span><span>
</span><span id="line-471"></span><span class="hs-comment">--    The details are in the documentation for 'typecheckIfacesForMerging'.</span><span>
</span><span id="line-472"></span><span class="hs-comment">--    and the Note [Resolving never-exported Names] in GHC.IfaceToCore.</span><span>
</span><span id="line-473"></span><span class="hs-comment">--</span><span>
</span><span id="line-474"></span><span class="hs-comment">--  * When we rename modules and signatures, we use the export lists to</span><span>
</span><span id="line-475"></span><span class="hs-comment">--    decide how the declarations should be renamed.  However, this</span><span>
</span><span id="line-476"></span><span class="hs-comment">--    means we don't get any guidance for how to rename non-exported</span><span>
</span><span id="line-477"></span><span class="hs-comment">--    entities.  Fortunately, we only need to rename these entities</span><span>
</span><span id="line-478"></span><span class="hs-comment">--    *consistently*, so that 'typecheckIfacesForMerging' can wire them</span><span>
</span><span id="line-479"></span><span class="hs-comment">--    up as needed.</span><span>
</span><span id="line-480"></span><span class="hs-comment">--</span><span>
</span><span id="line-481"></span><span class="hs-comment">--    The details are in Note [rnIfaceNeverExported] in 'GHC.Iface.Rename'.</span><span>
</span><span id="line-482"></span><span class="hs-comment">--</span><span>
</span><span id="line-483"></span><span class="hs-comment">-- The root cause for all of these complications is the fact that these</span><span>
</span><span id="line-484"></span><span class="hs-comment">-- logically &quot;implicit&quot; entities are defined indirectly in an interface</span><span>
</span><span id="line-485"></span><span class="hs-comment">-- file.  #13151 gives a proposal to make these *truly* implicit.</span><span>
</span><span id="line-486"></span><span>
</span><span id="line-487"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#merge_msg"><span class="hs-identifier hs-type">merge_msg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#InstantiatedModule"><span class="hs-identifier hs-type">InstantiatedModule</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-488"></span><span id="merge_msg"><span class="annot"><span class="annottext">merge_msg :: ModuleName -&gt; [InstantiatedModule] -&gt; SDoc
</span><a href="GHC.Tc.Utils.Backpack.html#merge_msg"><span class="hs-identifier hs-var hs-var">merge_msg</span></a></span></span><span> </span><span id="local-6989586621681160964"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160964"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-489"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;while checking the local signature&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160964"><span class="hs-identifier hs-var">mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-490"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;for consistency&quot;</span></span><span>
</span><span id="line-491"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#merge_msg"><span class="hs-identifier hs-var">merge_msg</span></a></span><span> </span><span id="local-6989586621681160963"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160963"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span> </span><span id="local-6989586621681160962"><span class="annot"><span class="annottext">[InstantiatedModule]
</span><a href="#local-6989586621681160962"><span class="hs-identifier hs-var">reqs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-492"></span><span>  </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;while merging the signatures from&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#colon"><span class="hs-identifier hs-var">colon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-493"></span><span>   </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#bullet"><span class="hs-identifier hs-var">bullet</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedModule -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedModule
</span><a href="#local-6989586621681160957"><span class="hs-identifier hs-var">req</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681160957"><span class="annot"><span class="annottext">InstantiatedModule
</span><a href="#local-6989586621681160957"><span class="hs-identifier hs-var">req</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[InstantiatedModule]
</span><a href="#local-6989586621681160962"><span class="hs-identifier hs-var">reqs</span></a></span><span> </span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-494"></span><span>      </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#bullet"><span class="hs-identifier hs-var">bullet</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;...and the local signature for&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160963"><span class="hs-identifier hs-var">mod_name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-495"></span><span>
</span><span id="line-496"></span><span class="hs-comment">-- | Given a local 'ModIface', merge all inherited requirements</span><span>
</span><span id="line-497"></span><span class="hs-comment">-- from 'requirementMerges' into this signature, producing</span><span>
</span><span id="line-498"></span><span class="hs-comment">-- a final 'TcGblEnv' that matches the local signature and</span><span>
</span><span id="line-499"></span><span class="hs-comment">-- all required signatures.</span><span>
</span><span id="line-500"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#mergeSignatures"><span class="hs-identifier hs-type">mergeSignatures</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HsParsedModule"><span class="hs-identifier hs-type">HsParsedModule</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span>
</span><span id="line-501"></span><span id="mergeSignatures"><span class="annot"><span class="annottext">mergeSignatures :: HsParsedModule
-&gt; TcGblEnv -&gt; ModIface -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
</span><a href="GHC.Tc.Utils.Backpack.html#mergeSignatures"><span class="hs-identifier hs-var hs-var">mergeSignatures</span></a></span></span><span>
</span><span id="line-502"></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Driver.Types.html#HsParsedModule"><span class="hs-identifier hs-type">HsParsedModule</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">hpm_module :: HsParsedModule -&gt; Located HsModule
</span><a href="GHC.Driver.Types.html#hpm_module"><span class="hs-identifier hs-var">hpm_module</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681160953"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681160953"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.html#HsModule"><span class="hs-identifier hs-type">HsModule</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">hsmodExports :: HsModule -&gt; Maybe (Located [LIE GhcPs])
</span><a href="GHC.Hs.html#hsmodExports"><span class="hs-identifier hs-var">hsmodExports</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681160950"><span class="annot"><span class="annottext">Maybe (Located [LIE GhcPs])
</span><a href="#local-6989586621681160950"><span class="hs-identifier hs-var">mb_exports</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-503"></span><span>                    </span><span class="annot"><span class="annottext">hpm_src_files :: HsParsedModule -&gt; [String]
</span><a href="GHC.Driver.Types.html#hpm_src_files"><span class="hs-identifier hs-var">hpm_src_files</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681160948"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681160948"><span class="hs-identifier hs-var">src_files</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-504"></span><span>  </span><span id="local-6989586621681160947"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160947"><span class="hs-identifier hs-var">orig_tcg_env</span></a></span></span><span> </span><span id="local-6989586621681160946"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160946"><span class="hs-identifier hs-var">lcl_iface0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681160953"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRnIf TcGblEnv TcLclEnv TcGblEnv
 -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv)
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-505"></span><span>    </span><span class="hs-comment">-- The lcl_iface0 is the ModIface for the local hsig</span><span>
</span><span id="line-506"></span><span>    </span><span class="hs-comment">-- file, which is guaranteed to exist, see</span><span>
</span><span id="line-507"></span><span>    </span><span class="hs-comment">-- Note [Blank hsigs for all requirements]</span><span>
</span><span id="line-508"></span><span>    </span><span id="local-6989586621681160944"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681160944"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv HscEnv
forall gbl lcl. TcRnIf gbl lcl HscEnv
</span><a href="GHC.Tc.Utils.Monad.html#getTopEnv"><span class="hs-identifier hs-var">getTopEnv</span></a></span><span>
</span><span id="line-509"></span><span>    </span><span id="local-6989586621681160942"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681160942"><span class="hs-identifier hs-var">dflags</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-510"></span><span>
</span><span id="line-511"></span><span>    </span><span class="hs-comment">-- Copy over some things from the original TcGblEnv that</span><span>
</span><span id="line-512"></span><span>    </span><span class="hs-comment">-- we want to preserve</span><span>
</span><span id="line-513"></span><span>    </span><span class="annot"><span class="annottext">(TcGblEnv -&gt; TcGblEnv)
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl a.
(gbl -&gt; gbl) -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#updGblEnv"><span class="hs-identifier hs-var">updGblEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681160939"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160939"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160939"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-514"></span><span>        </span><span class="hs-comment">-- Renamed imports/declarations are often used</span><span>
</span><span id="line-515"></span><span>        </span><span class="hs-comment">-- by programs that use the GHC API, e.g., Haddock.</span><span>
</span><span id="line-516"></span><span>        </span><span class="hs-comment">-- These won't get filled by the merging process (since</span><span>
</span><span id="line-517"></span><span>        </span><span class="hs-comment">-- we don't actually rename the parsed module again) so</span><span>
</span><span id="line-518"></span><span>        </span><span class="hs-comment">-- we need to take them directly from the previous</span><span>
</span><span id="line-519"></span><span>        </span><span class="hs-comment">-- typechecking.</span><span>
</span><span id="line-520"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-521"></span><span>        </span><span class="hs-comment">-- NB: the export declarations aren't in their final</span><span>
</span><span id="line-522"></span><span>        </span><span class="hs-comment">-- form yet.  We'll fill those in when we reprocess</span><span>
</span><span id="line-523"></span><span>        </span><span class="hs-comment">-- the export declarations.</span><span>
</span><span id="line-524"></span><span>        </span><span class="annot"><span class="annottext">tcg_rn_imports :: [LImportDecl (GhcPass 'Renamed)]
</span><a href="GHC.Tc.Types.html#tcg_rn_imports"><span class="hs-identifier hs-var">tcg_rn_imports</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; [LImportDecl (GhcPass 'Renamed)]
</span><a href="GHC.Tc.Types.html#tcg_rn_imports"><span class="hs-identifier hs-var hs-var">tcg_rn_imports</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160947"><span class="hs-identifier hs-var">orig_tcg_env</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-525"></span><span>        </span><span class="annot"><span class="annottext">tcg_rn_decls :: Maybe (HsGroup (GhcPass 'Renamed))
</span><a href="GHC.Tc.Types.html#tcg_rn_decls"><span class="hs-identifier hs-var">tcg_rn_decls</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; Maybe (HsGroup (GhcPass 'Renamed))
</span><a href="GHC.Tc.Types.html#tcg_rn_decls"><span class="hs-identifier hs-var hs-var">tcg_rn_decls</span></a></span><span>   </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160947"><span class="hs-identifier hs-var">orig_tcg_env</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-526"></span><span>        </span><span class="hs-comment">-- Annotations</span><span>
</span><span id="line-527"></span><span>        </span><span class="annot"><span class="annottext">tcg_ann_env :: AnnEnv
</span><a href="GHC.Tc.Types.html#tcg_ann_env"><span class="hs-identifier hs-var">tcg_ann_env</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; AnnEnv
</span><a href="GHC.Tc.Types.html#tcg_ann_env"><span class="hs-identifier hs-var hs-var">tcg_ann_env</span></a></span><span>    </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160947"><span class="hs-identifier hs-var">orig_tcg_env</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-528"></span><span>        </span><span class="hs-comment">-- Documentation header</span><span>
</span><span id="line-529"></span><span>        </span><span class="annot"><span class="annottext">tcg_doc_hdr :: Maybe LHsDocString
</span><a href="GHC.Tc.Types.html#tcg_doc_hdr"><span class="hs-identifier hs-var">tcg_doc_hdr</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; Maybe LHsDocString
</span><a href="GHC.Tc.Types.html#tcg_doc_hdr"><span class="hs-identifier hs-var hs-var">tcg_doc_hdr</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160947"><span class="hs-identifier hs-var">orig_tcg_env</span></a></span><span>
</span><span id="line-530"></span><span>        </span><span class="hs-comment">-- tcg_dus?</span><span>
</span><span id="line-531"></span><span>        </span><span class="hs-comment">-- tcg_th_used           = tcg_th_used orig_tcg_env,</span><span>
</span><span id="line-532"></span><span>        </span><span class="hs-comment">-- tcg_th_splice_used    = tcg_th_splice_used orig_tcg_env</span><span>
</span><span id="line-533"></span><span>       </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcRnIf TcGblEnv TcLclEnv TcGblEnv
 -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv)
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-534"></span><span>    </span><span id="local-6989586621681160934"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160934"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-535"></span><span>
</span><span id="line-536"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160933"><span class="annot"><span class="annottext">outer_mod :: Module
</span><a href="#local-6989586621681160933"><span class="hs-identifier hs-var hs-var">outer_mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_mod"><span class="hs-identifier hs-var hs-var">tcg_mod</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160934"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-537"></span><span>        </span><span id="local-6989586621681160931"><span class="annot"><span class="annottext">inner_mod :: Module
</span><a href="#local-6989586621681160931"><span class="hs-identifier hs-var hs-var">inner_mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_semantic_mod"><span class="hs-identifier hs-var hs-var">tcg_semantic_mod</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160934"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-538"></span><span>        </span><span id="local-6989586621681160930"><span class="annot"><span class="annottext">mod_name :: ModuleName
</span><a href="#local-6989586621681160930"><span class="hs-identifier hs-var hs-var">mod_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_mod"><span class="hs-identifier hs-var hs-var">tcg_mod</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160934"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-539"></span><span>        </span><span id="local-6989586621681160928"><span class="annot"><span class="annottext">pkgstate :: UnitState
</span><a href="#local-6989586621681160928"><span class="hs-identifier hs-var hs-var">pkgstate</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; UnitState
</span><a href="GHC.Driver.Session.html#unitState"><span class="hs-identifier hs-var hs-var">unitState</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681160942"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-540"></span><span>
</span><span id="line-541"></span><span>    </span><span class="hs-comment">-- STEP 1: Figure out all of the external signature interfaces</span><span>
</span><span id="line-542"></span><span>    </span><span class="hs-comment">-- we are going to merge in.</span><span>
</span><span id="line-543"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160927"><span class="annot"><span class="annottext">reqs :: [InstantiatedModule]
</span><a href="#local-6989586621681160927"><span class="hs-identifier hs-var hs-var">reqs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnitState -&gt; ModuleName -&gt; [InstantiatedModule]
</span><a href="GHC.Tc.Utils.Backpack.html#requirementMerges"><span class="hs-identifier hs-var">requirementMerges</span></a></span><span> </span><span class="annot"><span class="annottext">UnitState
</span><a href="#local-6989586621681160928"><span class="hs-identifier hs-var">pkgstate</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160930"><span class="hs-identifier hs-var">mod_name</span></a></span><span>
</span><span id="line-544"></span><span>
</span><span id="line-545"></span><span>    </span><span class="annot"><span class="annottext">SDoc
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall a. SDoc -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#addErrCtxt"><span class="hs-identifier hs-var">addErrCtxt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName -&gt; [InstantiatedModule] -&gt; SDoc
</span><a href="GHC.Tc.Utils.Backpack.html#merge_msg"><span class="hs-identifier hs-var">merge_msg</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160930"><span class="hs-identifier hs-var">mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">[InstantiatedModule]
</span><a href="#local-6989586621681160927"><span class="hs-identifier hs-var">reqs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcRnIf TcGblEnv TcLclEnv TcGblEnv
 -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv)
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-546"></span><span>
</span><span id="line-547"></span><span>    </span><span class="hs-comment">-- STEP 2: Read in the RAW forms of all of these interfaces</span><span>
</span><span id="line-548"></span><span>    </span><span id="local-6989586621681160925"><span class="annot"><span class="annottext">[ModIface]
</span><a href="#local-6989586621681160925"><span class="hs-identifier hs-var">ireq_ifaces0</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[InstantiatedModule]
-&gt; (InstantiatedModule -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [ModIface]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
t a -&gt; (a -&gt; m b) -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#forM"><span class="hs-identifier hs-var">forM</span></a></span><span> </span><span class="annot"><span class="annottext">[InstantiatedModule]
</span><a href="#local-6989586621681160927"><span class="hs-identifier hs-var">reqs</span></a></span><span> </span><span class="annot"><span class="annottext">((InstantiatedModule -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface)
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) [ModIface])
-&gt; (InstantiatedModule -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [ModIface]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span id="local-6989586621681160924"><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681160924"><span class="hs-identifier hs-var">iuid</span></a></span></span><span> </span><span id="local-6989586621681160923"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160923"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-549"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160922"><span class="annot"><span class="annottext">m :: Module
</span><a href="#local-6989586621681160922"><span class="hs-identifier hs-var hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unit -&gt; ModuleName -&gt; Module
forall unit. unit -&gt; ModuleName -&gt; GenModule unit
</span><a href="GHC.Unit.Types.html#mkModule"><span class="hs-identifier hs-var">mkModule</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InstantiatedUnit -&gt; Unit
forall uid. GenInstantiatedUnit uid -&gt; GenUnit uid
</span><a href="GHC.Unit.Types.html#VirtUnit"><span class="hs-identifier hs-var">VirtUnit</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681160924"><span class="hs-identifier hs-var">iuid</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160923"><span class="hs-identifier hs-var">mod_name</span></a></span><span>
</span><span id="line-550"></span><span>            </span><span id="local-6989586621681160921"><span class="annot"><span class="annottext">im :: InstalledModule
</span><a href="#local-6989586621681160921"><span class="hs-identifier hs-var hs-var">im</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(InstalledModule, Maybe InstantiatedModule) -&gt; InstalledModule
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; (InstalledModule, Maybe InstantiatedModule)
</span><a href="GHC.Unit.Module.html#getModuleInstantiation"><span class="hs-identifier hs-var">getModuleInstantiation</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160922"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-551"></span><span>        </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">((ModIface, String) -&gt; ModIface)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (ModIface, String)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">(ModIface, String) -&gt; ModIface
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span>
</span><span id="line-552"></span><span>         </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) (ModIface, String)
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface)
-&gt; (TcRnIf TcGblEnv TcLclEnv (MaybeErr SDoc (ModIface, String))
    -&gt; IOEnv (Env TcGblEnv TcLclEnv) (ModIface, String))
-&gt; TcRnIf TcGblEnv TcLclEnv (MaybeErr SDoc (ModIface, String))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv (MaybeErr SDoc (ModIface, String))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (ModIface, String)
forall gbl lcl a.
TcRnIf gbl lcl (MaybeErr SDoc a) -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#withException"><span class="hs-identifier hs-var">withException</span></a></span><span>
</span><span id="line-553"></span><span>         </span><span class="annot"><span class="annottext">(TcRnIf TcGblEnv TcLclEnv (MaybeErr SDoc (ModIface, String))
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface)
-&gt; TcRnIf TcGblEnv TcLclEnv (MaybeErr SDoc (ModIface, String))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
-&gt; InstalledModule
-&gt; Module
-&gt; IsBootInterface
-&gt; TcRnIf TcGblEnv TcLclEnv (MaybeErr SDoc (ModIface, String))
forall gbl lcl.
SDoc
-&gt; InstalledModule
-&gt; Module
-&gt; IsBootInterface
-&gt; TcRnIf gbl lcl (MaybeErr SDoc (ModIface, String))
</span><a href="GHC.Iface.Load.html#findAndReadIface"><span class="hs-identifier hs-var">findAndReadIface</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mergeSignatures&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">InstalledModule
</span><a href="#local-6989586621681160921"><span class="hs-identifier hs-var">im</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160922"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#NotBoot"><span class="hs-identifier hs-var">NotBoot</span></a></span><span>
</span><span id="line-554"></span><span>
</span><span id="line-555"></span><span>    </span><span class="hs-comment">-- STEP 3: Get the unrenamed exports of all these interfaces,</span><span>
</span><span id="line-556"></span><span>    </span><span class="hs-comment">-- thin it according to the export list, and do shaping on them.</span><span>
</span><span id="line-557"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160917"><span class="annot"><span class="annottext">extend_ns :: NameShape
-&gt; [AvailInfo]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Either SDoc NameShape)
</span><a href="#local-6989586621681160917"><span class="hs-identifier hs-var hs-var">extend_ns</span></a></span></span><span> </span><span id="local-6989586621681160916"><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681160916"><span class="hs-identifier hs-var">nsubst</span></a></span></span><span> </span><span id="local-6989586621681160915"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160915"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (Either SDoc NameShape)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Either SDoc NameShape)
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (Either SDoc NameShape)
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (Either SDoc NameShape))
-&gt; IO (Either SDoc NameShape)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Either SDoc NameShape)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; NameShape -&gt; [AvailInfo] -&gt; IO (Either SDoc NameShape)
</span><a href="GHC.Types.Name.Shape.html#extendNameShape"><span class="hs-identifier hs-var">extendNameShape</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681160944"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681160916"><span class="hs-identifier hs-var">nsubst</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160915"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-558"></span><span>        </span><span class="hs-comment">-- This function gets run on every inherited interface, and</span><span>
</span><span id="line-559"></span><span>        </span><span class="hs-comment">-- it's responsible for:</span><span>
</span><span id="line-560"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-561"></span><span>        </span><span class="hs-comment">--  1. Merging the exports of the interface into @nsubst@,</span><span>
</span><span id="line-562"></span><span>        </span><span class="hs-comment">--  2. Adding these exports to the &quot;OK to import&quot; set (@oks@)</span><span>
</span><span id="line-563"></span><span>        </span><span class="hs-comment">--  if they came from a package with no exposed modules</span><span>
</span><span id="line-564"></span><span>        </span><span class="hs-comment">--  (this means we won't report a PVP error in this case), and</span><span>
</span><span id="line-565"></span><span>        </span><span class="hs-comment">--  3. Thinning the interface according to an explicit export</span><span>
</span><span id="line-566"></span><span>        </span><span class="hs-comment">--  list.</span><span>
</span><span id="line-567"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-568"></span><span>        </span><span id="local-6989586621681160912"><span class="annot"><span class="annottext">gen_subst :: (NameShape, OccSet, [(InstantiatedModule, ModIface)])
-&gt; (InstantiatedModule, ModIface)
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (NameShape, OccSet, [(InstantiatedModule, ModIface)])
</span><a href="#local-6989586621681160912"><span class="hs-identifier hs-var hs-var">gen_subst</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681160911"><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681160911"><span class="hs-identifier hs-var">nsubst</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681160910"><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621681160910"><span class="hs-identifier hs-var">oks</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681160909"><span class="annot"><span class="annottext">[(InstantiatedModule, ModIface)]
</span><a href="#local-6989586621681160909"><span class="hs-identifier hs-var">ifaces</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681160908"><span class="annot"><span class="annottext">imod :: InstantiatedModule
</span><a href="#local-6989586621681160908"><span class="hs-identifier hs-var">imod</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span id="local-6989586621681160907"><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681160907"><span class="hs-identifier hs-var">iuid</span></a></span></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160906"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160906"><span class="hs-identifier hs-var">ireq_iface</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-569"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160905"><span class="annot"><span class="annottext">insts :: GenInstantiations UnitId
</span><a href="#local-6989586621681160905"><span class="hs-identifier hs-var hs-var">insts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit -&gt; GenInstantiations UnitId
forall unit. GenInstantiatedUnit unit -&gt; GenInstantiations unit
</span><a href="GHC.Unit.Types.html#instUnitInsts"><span class="hs-identifier hs-var hs-var">instUnitInsts</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681160907"><span class="hs-identifier hs-var">iuid</span></a></span><span>
</span><span id="line-570"></span><span>                </span><span id="local-6989586621681160904"><span class="annot"><span class="annottext">isFromSignaturePackage :: Bool
</span><a href="#local-6989586621681160904"><span class="hs-identifier hs-var hs-var">isFromSignaturePackage</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-571"></span><span>                    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160903"><span class="annot"><span class="annottext">inst_uid :: Indefinite UnitId
</span><a href="#local-6989586621681160903"><span class="hs-identifier hs-var hs-var">inst_uid</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit -&gt; Indefinite UnitId
forall unit. GenInstantiatedUnit unit -&gt; Indefinite unit
</span><a href="GHC.Unit.Types.html#instUnitInstanceOf"><span class="hs-identifier hs-var hs-var">instUnitInstanceOf</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681160907"><span class="hs-identifier hs-var">iuid</span></a></span><span>
</span><span id="line-572"></span><span>                        </span><span id="local-6989586621681160902"><span class="annot"><span class="annottext">pkg :: UnitInfo
</span><a href="#local-6989586621681160902"><span class="hs-identifier hs-var hs-var">pkg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; UnitState -&gt; UnitId -&gt; UnitInfo
UnitState -&gt; UnitId -&gt; UnitInfo
</span><a href="GHC.Unit.State.html#unsafeLookupUnitId"><span class="hs-identifier hs-var">unsafeLookupUnitId</span></a></span><span> </span><span class="annot"><span class="annottext">UnitState
</span><a href="#local-6989586621681160928"><span class="hs-identifier hs-var">pkgstate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Indefinite UnitId -&gt; UnitId
forall unit. Indefinite unit -&gt; unit
</span><a href="GHC.Unit.Types.html#indefUnit"><span class="hs-identifier hs-var hs-var">indefUnit</span></a></span><span> </span><span class="annot"><span class="annottext">Indefinite UnitId
</span><a href="#local-6989586621681160903"><span class="hs-identifier hs-var">inst_uid</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-573"></span><span>                    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">[(ModuleName, Maybe Module)] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnitInfo -&gt; [(ModuleName, Maybe Module)]
forall compid srcpkgid srcpkgname uid modulename mod.
GenericUnitInfo compid srcpkgid srcpkgname uid modulename mod
-&gt; [(modulename, Maybe mod)]
</span><a href="../../ghc-boot/src/GHC.Unit.Database.html#unitExposedModules"><span class="hs-identifier hs-var hs-var">unitExposedModules</span></a></span><span> </span><span class="annot"><span class="annottext">UnitInfo
</span><a href="#local-6989586621681160902"><span class="hs-identifier hs-var">pkg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-574"></span><span>            </span><span class="hs-comment">-- 3(a). Rename the exports according to how the dependency</span><span>
</span><span id="line-575"></span><span>            </span><span class="hs-comment">-- was instantiated.  The resulting export list will be accurate</span><span>
</span><span id="line-576"></span><span>            </span><span class="hs-comment">-- except for exports *from the signature itself* (which may</span><span>
</span><span id="line-577"></span><span>            </span><span class="hs-comment">-- be subsequently updated by exports from other signatures in</span><span>
</span><span id="line-578"></span><span>            </span><span class="hs-comment">-- the merge.</span><span>
</span><span id="line-579"></span><span>            </span><span id="local-6989586621681160898"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160898"><span class="hs-identifier hs-var">as1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GenInstantiations UnitId -&gt; ModIface -&gt; TcM [AvailInfo]
</span><a href="GHC.Iface.Rename.html#tcRnModExports"><span class="hs-identifier hs-var">tcRnModExports</span></a></span><span> </span><span class="annot"><span class="annottext">GenInstantiations UnitId
</span><a href="#local-6989586621681160905"><span class="hs-identifier hs-var">insts</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160906"><span class="hs-identifier hs-var">ireq_iface</span></a></span><span>
</span><span id="line-580"></span><span>            </span><span class="hs-comment">-- 3(b). Thin the interface if it comes from a signature package.</span><span>
</span><span id="line-581"></span><span>            </span><span class="hs-special">(</span><span id="local-6989586621681160896"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160896"><span class="hs-identifier hs-var">thinned_iface</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160895"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160895"><span class="hs-identifier hs-var">as2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe (Located [LIE GhcPs])
</span><a href="#local-6989586621681160950"><span class="hs-identifier hs-var">mb_exports</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-582"></span><span>                    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681160894"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681160894"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="annot"><span class="annottext">[LIE GhcPs]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-583"></span><span>                      </span><span class="hs-comment">-- Check if the package containing this signature is</span><span>
</span><span id="line-584"></span><span>                      </span><span class="hs-comment">-- a signature package (i.e., does not expose any</span><span>
</span><span id="line-585"></span><span>                      </span><span class="hs-comment">-- modules.)  If so, we can thin it.</span><span>
</span><span id="line-586"></span><span>                      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681160904"><span class="hs-identifier hs-var">isFromSignaturePackage</span></a></span><span>
</span><span id="line-587"></span><span>                      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (ModIface, [AvailInfo])
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (ModIface, [AvailInfo])
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681160894"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) (ModIface, [AvailInfo])
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (ModIface, [AvailInfo]))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (ModIface, [AvailInfo])
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (ModIface, [AvailInfo])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-588"></span><span>                        </span><span class="hs-comment">-- Suppress missing errors; they might be used to refer</span><span>
</span><span id="line-589"></span><span>                        </span><span class="hs-comment">-- to entities from other signatures we are merging in.</span><span>
</span><span id="line-590"></span><span>                        </span><span class="hs-comment">-- If an identifier truly doesn't exist in any of the</span><span>
</span><span id="line-591"></span><span>                        </span><span class="hs-comment">-- signatures that are merged in, we will discover this</span><span>
</span><span id="line-592"></span><span>                        </span><span class="hs-comment">-- when we run exports_from_avail on the final merged</span><span>
</span><span id="line-593"></span><span>                        </span><span class="hs-comment">-- export list.</span><span>
</span><span id="line-594"></span><span>                        </span><span class="hs-special">(</span><span id="local-6989586621681160893"><span class="annot"><span class="annottext">Maybe
  (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
   [AvailInfo])
</span><a href="#local-6989586621681160893"><span class="hs-identifier hs-var">mb_r</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160892"><span class="annot"><span class="annottext">Messages
</span><a href="#local-6989586621681160892"><span class="hs-identifier hs-var">msgs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRn
  (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
   [AvailInfo])
-&gt; TcRn
     (Maybe
        (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
         [AvailInfo]),
      Messages)
forall a. TcRn a -&gt; TcRn (Maybe a, Messages)
</span><a href="GHC.Tc.Utils.Monad.html#tryTc"><span class="hs-identifier hs-var">tryTc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRn
   (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
    [AvailInfo])
 -&gt; TcRn
      (Maybe
         (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
          [AvailInfo]),
       Messages))
-&gt; TcRn
     (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
      [AvailInfo])
-&gt; TcRn
     (Maybe
        (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
         [AvailInfo]),
      Messages)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-595"></span><span>                            </span><span class="hs-comment">-- Suppose that we have written in a signature:</span><span>
</span><span id="line-596"></span><span>                            </span><span class="hs-comment">--  signature A ( module A ) where {- empty -}</span><span>
</span><span id="line-597"></span><span>                            </span><span class="hs-comment">-- If I am also inheriting a signature from a</span><span>
</span><span id="line-598"></span><span>                            </span><span class="hs-comment">-- signature package, does 'module A' scope over</span><span>
</span><span id="line-599"></span><span>                            </span><span class="hs-comment">-- all of its exports?</span><span>
</span><span id="line-600"></span><span>                            </span><span class="hs-comment">--</span><span>
</span><span id="line-601"></span><span>                            </span><span class="hs-comment">-- There are two possible interpretations:</span><span>
</span><span id="line-602"></span><span>                            </span><span class="hs-comment">--</span><span>
</span><span id="line-603"></span><span>                            </span><span class="hs-comment">--  1. For non self-reexports, a module reexport</span><span>
</span><span id="line-604"></span><span>                            </span><span class="hs-comment">--  is interpreted only in terms of the local</span><span>
</span><span id="line-605"></span><span>                            </span><span class="hs-comment">--  signature module, and not any of the inherited</span><span>
</span><span id="line-606"></span><span>                            </span><span class="hs-comment">--  ones.  The reason for this is because after</span><span>
</span><span id="line-607"></span><span>                            </span><span class="hs-comment">--  typechecking, module exports are completely</span><span>
</span><span id="line-608"></span><span>                            </span><span class="hs-comment">--  erased from the interface of a file, so we</span><span>
</span><span id="line-609"></span><span>                            </span><span class="hs-comment">--  have no way of &quot;interpreting&quot; a module reexport.</span><span>
</span><span id="line-610"></span><span>                            </span><span class="hs-comment">--  Thus, it's only useful for the local signature</span><span>
</span><span id="line-611"></span><span>                            </span><span class="hs-comment">--  module (where we have a useful GlobalRdrEnv.)</span><span>
</span><span id="line-612"></span><span>                            </span><span class="hs-comment">--</span><span>
</span><span id="line-613"></span><span>                            </span><span class="hs-comment">--  2. On the other hand, a common idiom when</span><span>
</span><span id="line-614"></span><span>                            </span><span class="hs-comment">--  you want to &quot;export everything, plus a reexport&quot;</span><span>
</span><span id="line-615"></span><span>                            </span><span class="hs-comment">--  in modules is to say module A ( module A, reex ).</span><span>
</span><span id="line-616"></span><span>                            </span><span class="hs-comment">--  This applies to signature modules too; and in</span><span>
</span><span id="line-617"></span><span>                            </span><span class="hs-comment">--  particular, you probably still want the entities</span><span>
</span><span id="line-618"></span><span>                            </span><span class="hs-comment">--  from the inherited signatures to be preserved</span><span>
</span><span id="line-619"></span><span>                            </span><span class="hs-comment">--  too.</span><span>
</span><span id="line-620"></span><span>                            </span><span class="hs-comment">--</span><span>
</span><span id="line-621"></span><span>                            </span><span class="hs-comment">-- We think it's worth making a special case for</span><span>
</span><span id="line-622"></span><span>                            </span><span class="hs-comment">-- self reexports to make use case (2) work.  To</span><span>
</span><span id="line-623"></span><span>                            </span><span class="hs-comment">-- do this, we take the exports of the inherited</span><span>
</span><span id="line-624"></span><span>                            </span><span class="hs-comment">-- signature @as1@, and bundle them into a</span><span>
</span><span id="line-625"></span><span>                            </span><span class="hs-comment">-- GlobalRdrEnv where we treat them as having come</span><span>
</span><span id="line-626"></span><span>                            </span><span class="hs-comment">-- from the import @import A@.  Thus, we will</span><span>
</span><span id="line-627"></span><span>                            </span><span class="hs-comment">-- pick them up if they are referenced explicitly</span><span>
</span><span id="line-628"></span><span>                            </span><span class="hs-comment">-- (@foo@) or even if we do a module reexport</span><span>
</span><span id="line-629"></span><span>                            </span><span class="hs-comment">-- (@module A@).</span><span>
</span><span id="line-630"></span><span>                            </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160890"><span class="annot"><span class="annottext">ispec :: ImportSpec
</span><a href="#local-6989586621681160890"><span class="hs-identifier hs-var hs-var">ispec</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec -&gt; ImpItemSpec -&gt; ImportSpec
</span><a href="GHC.Types.Name.Reader.html#ImpSpec"><span class="hs-identifier hs-var">ImpSpec</span></a></span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec :: ModuleName -&gt; ModuleName -&gt; Bool -&gt; SrcSpan -&gt; ImpDeclSpec
</span><a href="GHC.Types.Name.Reader.html#ImpDeclSpec"><span class="hs-identifier hs-type">ImpDeclSpec</span></a></span><span class="hs-special">{</span><span>
</span><span id="line-631"></span><span>                                            </span><span class="hs-comment">-- NB: This needs to be mod name</span><span>
</span><span id="line-632"></span><span>                                            </span><span class="hs-comment">-- of the local signature, not</span><span>
</span><span id="line-633"></span><span>                                            </span><span class="hs-comment">-- the (original) module name of</span><span>
</span><span id="line-634"></span><span>                                            </span><span class="hs-comment">-- the inherited signature,</span><span>
</span><span id="line-635"></span><span>                                            </span><span class="hs-comment">-- because we need module</span><span>
</span><span id="line-636"></span><span>                                            </span><span class="hs-comment">-- LocalSig (from the local</span><span>
</span><span id="line-637"></span><span>                                            </span><span class="hs-comment">-- export list) to match it!</span><span>
</span><span id="line-638"></span><span>                                            </span><span class="annot"><span class="annottext">is_mod :: ModuleName
</span><a href="GHC.Types.Name.Reader.html#is_mod"><span class="hs-identifier hs-var">is_mod</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160930"><span class="hs-identifier hs-var">mod_name</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-639"></span><span>                                            </span><span class="annot"><span class="annottext">is_as :: ModuleName
</span><a href="GHC.Types.Name.Reader.html#is_as"><span class="hs-identifier hs-var">is_as</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160930"><span class="hs-identifier hs-var">mod_name</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-640"></span><span>                                            </span><span class="annot"><span class="annottext">is_qual :: Bool
</span><a href="GHC.Types.Name.Reader.html#is_qual"><span class="hs-identifier hs-var">is_qual</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span>
</span><span id="line-641"></span><span>                                            </span><span class="annot"><span class="annottext">is_dloc :: SrcSpan
</span><a href="GHC.Types.Name.Reader.html#is_dloc"><span class="hs-identifier hs-var">is_dloc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681160894"><span class="hs-identifier hs-var">loc</span></a></span><span>
</span><span id="line-642"></span><span>                                          </span><span class="hs-special">}</span><span> </span><span class="annot"><span class="annottext">ImpItemSpec
</span><a href="GHC.Types.Name.Reader.html#ImpAll"><span class="hs-identifier hs-var">ImpAll</span></a></span><span>
</span><span id="line-643"></span><span>                                </span><span id="local-6989586621681160882"><span class="annot"><span class="annottext">rdr_env :: GlobalRdrEnv
</span><a href="#local-6989586621681160882"><span class="hs-identifier hs-var hs-var">rdr_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt] -&gt; GlobalRdrEnv
</span><a href="GHC.Types.Name.Reader.html#mkGlobalRdrEnv"><span class="hs-identifier hs-var">mkGlobalRdrEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe ImportSpec -&gt; [AvailInfo] -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#gresFromAvails"><span class="hs-identifier hs-var">gresFromAvails</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImportSpec -&gt; Maybe ImportSpec
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">ImportSpec
</span><a href="#local-6989586621681160890"><span class="hs-identifier hs-var">ispec</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160898"><span class="hs-identifier hs-var">as1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-644"></span><span>                            </span><span class="annot"><span class="annottext">TcGblEnv
-&gt; TcRn
     (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
      [AvailInfo])
-&gt; TcRn
     (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
      [AvailInfo])
forall gbl lcl a. gbl -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setGblEnv"><span class="hs-identifier hs-var">setGblEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160934"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-645"></span><span>                                </span><span class="annot"><span class="annottext">tcg_rdr_env :: GlobalRdrEnv
</span><a href="GHC.Tc.Types.html#tcg_rdr_env"><span class="hs-identifier hs-var">tcg_rdr_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681160882"><span class="hs-identifier hs-var">rdr_env</span></a></span><span>
</span><span id="line-646"></span><span>                            </span><span class="hs-special">}</span><span> </span><span class="annot"><span class="annottext">(TcRn
   (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
    [AvailInfo])
 -&gt; TcRn
      (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
       [AvailInfo]))
-&gt; TcRn
     (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
      [AvailInfo])
-&gt; TcRn
     (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
      [AvailInfo])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Located [LIE GhcPs])
-&gt; GlobalRdrEnv
-&gt; ImportAvails
-&gt; Module
-&gt; TcRn
     (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
      [AvailInfo])
</span><a href="GHC.Tc.Gen.Export.html#exports_from_avail"><span class="hs-identifier hs-var">exports_from_avail</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Located [LIE GhcPs])
</span><a href="#local-6989586621681160950"><span class="hs-identifier hs-var">mb_exports</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681160882"><span class="hs-identifier hs-var">rdr_env</span></a></span><span>
</span><span id="line-647"></span><span>                                    </span><span class="hs-comment">-- NB: tcg_imports is also empty!</span><span>
</span><span id="line-648"></span><span>                                    </span><span class="annot"><span class="annottext">ImportAvails
</span><a href="GHC.Tc.Types.html#emptyImportAvails"><span class="hs-identifier hs-var">emptyImportAvails</span></a></span><span>
</span><span id="line-649"></span><span>                                    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_semantic_mod"><span class="hs-identifier hs-var hs-var">tcg_semantic_mod</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160934"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-650"></span><span>                        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe
  (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
   [AvailInfo])
</span><a href="#local-6989586621681160893"><span class="hs-identifier hs-var">mb_r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-651"></span><span>                            </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160876"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160876"><span class="hs-identifier hs-var">as2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(ModIface, [AvailInfo])
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (ModIface, [AvailInfo])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[AvailInfo] -&gt; ModIface -&gt; ModIface
</span><a href="GHC.Tc.Utils.Backpack.html#thinModIface"><span class="hs-identifier hs-var">thinModIface</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160876"><span class="hs-identifier hs-var">as2</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160906"><span class="hs-identifier hs-var">ireq_iface</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160876"><span class="hs-identifier hs-var">as2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-652"></span><span>                            </span><span class="annot"><span class="annottext">Maybe
  (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
   [AvailInfo])
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Messages -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#addMessages"><span class="hs-identifier hs-var">addMessages</span></a></span><span> </span><span class="annot"><span class="annottext">Messages
</span><a href="#local-6989586621681160892"><span class="hs-identifier hs-var">msgs</span></a></span><span> </span><span class="annot"><span class="annottext">TcRn ()
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (ModIface, [AvailInfo])
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (ModIface, [AvailInfo])
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) (ModIface, [AvailInfo])
forall env a. IOEnv env a
</span><a href="GHC.Data.IOEnv.html#failM"><span class="hs-identifier hs-var">failM</span></a></span><span>
</span><span id="line-653"></span><span>                    </span><span class="hs-comment">-- We can't think signatures from non signature packages</span><span>
</span><span id="line-654"></span><span>                    </span><span class="annot"><span class="annottext">Maybe (Located [LIE GhcPs])
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(ModIface, [AvailInfo])
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (ModIface, [AvailInfo])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160906"><span class="hs-identifier hs-var">ireq_iface</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160898"><span class="hs-identifier hs-var">as1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-655"></span><span>            </span><span class="hs-comment">-- 3(c). Only identifiers from signature packages are &quot;ok&quot; to</span><span>
</span><span id="line-656"></span><span>            </span><span class="hs-comment">-- import (that is, they are safe from a PVP perspective.)</span><span>
</span><span id="line-657"></span><span>            </span><span class="hs-comment">-- (NB: This code is actually dead right now.)</span><span>
</span><span id="line-658"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160873"><span class="annot"><span class="annottext">oks' :: OccSet
</span><a href="#local-6989586621681160873"><span class="hs-identifier hs-var hs-var">oks'</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681160904"><span class="hs-identifier hs-var">isFromSignaturePackage</span></a></span><span>
</span><span id="line-659"></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccSet -&gt; [OccName] -&gt; OccSet
</span><a href="GHC.Types.Name.Occurrence.html#extendOccSetList"><span class="hs-identifier hs-var">extendOccSetList</span></a></span><span> </span><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621681160910"><span class="hs-identifier hs-var">oks</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[AvailInfo] -&gt; [OccName]
</span><a href="GHC.Tc.Utils.Backpack.html#exportOccs"><span class="hs-identifier hs-var">exportOccs</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160895"><span class="hs-identifier hs-var">as2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-660"></span><span>                     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-661"></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621681160910"><span class="hs-identifier hs-var">oks</span></a></span><span>
</span><span id="line-662"></span><span>            </span><span class="hs-comment">-- 3(d). Extend the name substitution (performing shaping)</span><span>
</span><span id="line-663"></span><span>            </span><span id="local-6989586621681160870"><span class="annot"><span class="annottext">Either SDoc NameShape
</span><a href="#local-6989586621681160870"><span class="hs-identifier hs-var">mb_r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">NameShape
-&gt; [AvailInfo]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Either SDoc NameShape)
</span><a href="#local-6989586621681160917"><span class="hs-identifier hs-var">extend_ns</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681160911"><span class="hs-identifier hs-var">nsubst</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160895"><span class="hs-identifier hs-var">as2</span></a></span><span>
</span><span id="line-664"></span><span>            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Either SDoc NameShape
</span><a href="#local-6989586621681160870"><span class="hs-identifier hs-var">mb_r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-665"></span><span>                </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621681160869"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681160869"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (NameShape, OccSet, [(InstantiatedModule, ModIface)])
forall a. SDoc -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#failWithTc"><span class="hs-identifier hs-var">failWithTc</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681160869"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-666"></span><span>                </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621681160867"><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681160867"><span class="hs-identifier hs-var">nsubst'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(NameShape, OccSet, [(InstantiatedModule, ModIface)])
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (NameShape, OccSet, [(InstantiatedModule, ModIface)])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681160867"><span class="hs-identifier hs-var">nsubst'</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621681160873"><span class="hs-identifier hs-var">oks'</span></a></span><span class="hs-special">,</span><span class="hs-special">(</span><span class="annot"><span class="annottext">InstantiatedModule
</span><a href="#local-6989586621681160908"><span class="hs-identifier hs-var">imod</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160896"><span class="hs-identifier hs-var">thinned_iface</span></a></span><span class="hs-special">)</span><span class="annot"><span class="annottext">(InstantiatedModule, ModIface)
-&gt; [(InstantiatedModule, ModIface)]
-&gt; [(InstantiatedModule, ModIface)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[(InstantiatedModule, ModIface)]
</span><a href="#local-6989586621681160909"><span class="hs-identifier hs-var">ifaces</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-667"></span><span>        </span><span id="local-6989586621681160866"><span class="annot"><span class="annottext">nsubst0 :: NameShape
</span><a href="#local-6989586621681160866"><span class="hs-identifier hs-var hs-var">nsubst0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; [AvailInfo] -&gt; NameShape
</span><a href="GHC.Types.Name.Shape.html#mkNameShape"><span class="hs-identifier hs-var">mkNameShape</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160931"><span class="hs-identifier hs-var">inner_mod</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; [AvailInfo]
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; [AvailInfo]
</span><a href="GHC.Driver.Types.html#mi_exports"><span class="hs-identifier hs-var hs-var">mi_exports</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160946"><span class="hs-identifier hs-var">lcl_iface0</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-668"></span><span>        </span><span id="local-6989586621681160864"><span class="annot"><span class="annottext">ok_to_use0 :: OccSet
</span><a href="#local-6989586621681160864"><span class="hs-identifier hs-var hs-var">ok_to_use0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[OccName] -&gt; OccSet
</span><a href="GHC.Types.Name.Occurrence.html#mkOccSet"><span class="hs-identifier hs-var">mkOccSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[AvailInfo] -&gt; [OccName]
</span><a href="GHC.Tc.Utils.Backpack.html#exportOccs"><span class="hs-identifier hs-var">exportOccs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; [AvailInfo]
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; [AvailInfo]
</span><a href="GHC.Driver.Types.html#mi_exports"><span class="hs-identifier hs-var hs-var">mi_exports</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160946"><span class="hs-identifier hs-var">lcl_iface0</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-669"></span><span>    </span><span class="hs-comment">-- Process each interface, getting the thinned interfaces as well as</span><span>
</span><span id="line-670"></span><span>    </span><span class="hs-comment">-- the final, full set of exports @nsubst@ and the exports which are</span><span>
</span><span id="line-671"></span><span>    </span><span class="hs-comment">-- &quot;ok to use&quot; (we won't attach 'inheritedSigPvpWarning' to them.)</span><span>
</span><span id="line-672"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681160863"><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681160863"><span class="hs-identifier hs-var">nsubst</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160862"><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621681160862"><span class="hs-identifier hs-var">ok_to_use</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160861"><span class="annot"><span class="annottext">[(InstantiatedModule, ModIface)]
</span><a href="#local-6989586621681160861"><span class="hs-identifier hs-var">rev_thinned_ifaces</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-673"></span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">((NameShape, OccSet, [(InstantiatedModule, ModIface)])
 -&gt; (InstantiatedModule, ModIface)
 -&gt; IOEnv
      (Env TcGblEnv TcLclEnv)
      (NameShape, OccSet, [(InstantiatedModule, ModIface)]))
-&gt; (NameShape, OccSet, [(InstantiatedModule, ModIface)])
-&gt; [(InstantiatedModule, ModIface)]
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (NameShape, OccSet, [(InstantiatedModule, ModIface)])
forall (t :: * -&gt; *) (m :: * -&gt; *) b a.
(Foldable t, Monad m) =&gt;
(b -&gt; a -&gt; m b) -&gt; b -&gt; t a -&gt; m b
</span><a href="../../base/src/Control.Monad.html#foldM"><span class="hs-identifier hs-var">foldM</span></a></span><span> </span><span class="annot"><span class="annottext">(NameShape, OccSet, [(InstantiatedModule, ModIface)])
-&gt; (InstantiatedModule, ModIface)
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (NameShape, OccSet, [(InstantiatedModule, ModIface)])
</span><a href="#local-6989586621681160912"><span class="hs-identifier hs-var">gen_subst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681160866"><span class="hs-identifier hs-var">nsubst0</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621681160864"><span class="hs-identifier hs-var">ok_to_use0</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[InstantiatedModule]
-&gt; [ModIface] -&gt; [(InstantiatedModule, ModIface)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="annot"><span class="annottext">[InstantiatedModule]
</span><a href="#local-6989586621681160927"><span class="hs-identifier hs-var">reqs</span></a></span><span> </span><span class="annot"><span class="annottext">[ModIface]
</span><a href="#local-6989586621681160925"><span class="hs-identifier hs-var">ireq_ifaces0</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-674"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160859"><span class="annot"><span class="annottext">thinned_ifaces :: [(InstantiatedModule, ModIface)]
</span><a href="#local-6989586621681160859"><span class="hs-identifier hs-var hs-var">thinned_ifaces</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(InstantiatedModule, ModIface)]
-&gt; [(InstantiatedModule, ModIface)]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[(InstantiatedModule, ModIface)]
</span><a href="#local-6989586621681160861"><span class="hs-identifier hs-var">rev_thinned_ifaces</span></a></span><span>
</span><span id="line-675"></span><span>        </span><span id="local-6989586621681160857"><span class="annot"><span class="annottext">exports :: [AvailInfo]
</span><a href="#local-6989586621681160857"><span class="hs-identifier hs-var hs-var">exports</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameShape -&gt; [AvailInfo]
</span><a href="GHC.Types.Name.Shape.html#nameShapeExports"><span class="hs-identifier hs-var">nameShapeExports</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681160863"><span class="hs-identifier hs-var">nsubst</span></a></span><span>
</span><span id="line-676"></span><span>        </span><span id="local-6989586621681160855"><span class="annot"><span class="annottext">rdr_env :: GlobalRdrEnv
</span><a href="#local-6989586621681160855"><span class="hs-identifier hs-var hs-var">rdr_env</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt] -&gt; GlobalRdrEnv
</span><a href="GHC.Types.Name.Reader.html#mkGlobalRdrEnv"><span class="hs-identifier hs-var">mkGlobalRdrEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe ImportSpec -&gt; [AvailInfo] -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#gresFromAvails"><span class="hs-identifier hs-var">gresFromAvails</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe ImportSpec
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160857"><span class="hs-identifier hs-var">exports</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-677"></span><span>        </span><span id="local-6989586621681160854"><span class="annot"><span class="annottext">_warn_occs :: [OccName]
</span><a href="#local-6989586621681160854"><span class="hs-identifier hs-var hs-var">_warn_occs</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(OccName -&gt; Bool) -&gt; [OccName] -&gt; [OccName]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (OccName -&gt; Bool) -&gt; OccName -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccName -&gt; OccSet -&gt; Bool
</span><a href="GHC.Types.Name.Occurrence.html#elemOccSet"><span class="hs-operator hs-var">`elemOccSet`</span></a></span><span> </span><span class="annot"><span class="annottext">OccSet
</span><a href="#local-6989586621681160862"><span class="hs-identifier hs-var">ok_to_use</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[AvailInfo] -&gt; [OccName]
</span><a href="GHC.Tc.Utils.Backpack.html#exportOccs"><span class="hs-identifier hs-var">exportOccs</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160857"><span class="hs-identifier hs-var">exports</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-678"></span><span>        </span><span id="local-6989586621681160853"><span class="annot"><span class="annottext">warns :: Warnings
</span><a href="#local-6989586621681160853"><span class="hs-identifier hs-var hs-var">warns</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Warnings
</span><a href="GHC.Driver.Types.html#NoWarnings"><span class="hs-identifier hs-var">NoWarnings</span></a></span><span>
</span><span id="line-679"></span><span>        </span><span class="hs-comment">{-
        -- TODO: Warnings are transitive, but this is not what we want here:
        -- if a module reexports an entity from a signature, that should be OK.
        -- Not supported in current warning framework
        warns | null warn_occs = NoWarnings
              | otherwise = WarnSome $ map (\o -&gt; (o, inheritedSigPvpWarning)) warn_occs
        -}</span><span>
</span><span id="line-686"></span><span>    </span><span class="annot"><span class="annottext">TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl a. gbl -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setGblEnv"><span class="hs-identifier hs-var">setGblEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160934"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-687"></span><span>        </span><span class="hs-comment">-- The top-level GlobalRdrEnv is quite interesting.  It consists</span><span>
</span><span id="line-688"></span><span>        </span><span class="hs-comment">-- of two components:</span><span>
</span><span id="line-689"></span><span>        </span><span class="hs-comment">--  1. First, we reuse the GlobalRdrEnv of the local signature.</span><span>
</span><span id="line-690"></span><span>        </span><span class="hs-comment">--     This is very useful, because it means that if we have</span><span>
</span><span id="line-691"></span><span>        </span><span class="hs-comment">--     to print a message involving some entity that the local</span><span>
</span><span id="line-692"></span><span>        </span><span class="hs-comment">--     signature imported, we'll qualify it accordingly.</span><span>
</span><span id="line-693"></span><span>        </span><span class="hs-comment">--  2. Second, we need to add all of the declarations we are</span><span>
</span><span id="line-694"></span><span>        </span><span class="hs-comment">--     going to merge in (as they need to be in scope for the</span><span>
</span><span id="line-695"></span><span>        </span><span class="hs-comment">--     final test of the export list.)</span><span>
</span><span id="line-696"></span><span>        </span><span class="annot"><span class="annottext">tcg_rdr_env :: GlobalRdrEnv
</span><a href="GHC.Tc.Types.html#tcg_rdr_env"><span class="hs-identifier hs-var">tcg_rdr_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681160855"><span class="hs-identifier hs-var">rdr_env</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; GlobalRdrEnv -&gt; GlobalRdrEnv
</span><a href="GHC.Types.Name.Reader.html#plusGlobalRdrEnv"><span class="hs-operator hs-var">`plusGlobalRdrEnv`</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; GlobalRdrEnv
</span><a href="GHC.Tc.Types.html#tcg_rdr_env"><span class="hs-identifier hs-var hs-var">tcg_rdr_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160947"><span class="hs-identifier hs-var">orig_tcg_env</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-697"></span><span>        </span><span class="hs-comment">-- Inherit imports from the local signature, so that module</span><span>
</span><span id="line-698"></span><span>        </span><span class="hs-comment">-- reexports are picked up correctly</span><span>
</span><span id="line-699"></span><span>        </span><span class="annot"><span class="annottext">tcg_imports :: ImportAvails
</span><a href="GHC.Tc.Types.html#tcg_imports"><span class="hs-identifier hs-var">tcg_imports</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; ImportAvails
</span><a href="GHC.Tc.Types.html#tcg_imports"><span class="hs-identifier hs-var hs-var">tcg_imports</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160947"><span class="hs-identifier hs-var">orig_tcg_env</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-700"></span><span>        </span><span class="annot"><span class="annottext">tcg_exports :: [AvailInfo]
</span><a href="GHC.Tc.Types.html#tcg_exports"><span class="hs-identifier hs-var">tcg_exports</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160857"><span class="hs-identifier hs-var">exports</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-701"></span><span>        </span><span class="annot"><span class="annottext">tcg_dus :: DefUses
</span><a href="GHC.Tc.Types.html#tcg_dus"><span class="hs-identifier hs-var">tcg_dus</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameSet -&gt; DefUses
</span><a href="GHC.Types.Name.Set.html#usesOnly"><span class="hs-identifier hs-var">usesOnly</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[AvailInfo] -&gt; NameSet
</span><a href="GHC.Types.Avail.html#availsToNameSetWithSelectors"><span class="hs-identifier hs-var">availsToNameSetWithSelectors</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160857"><span class="hs-identifier hs-var">exports</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-702"></span><span>        </span><span class="annot"><span class="annottext">tcg_warns :: Warnings
</span><a href="GHC.Tc.Types.html#tcg_warns"><span class="hs-identifier hs-var">tcg_warns</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Warnings
</span><a href="#local-6989586621681160853"><span class="hs-identifier hs-var">warns</span></a></span><span>
</span><span id="line-703"></span><span>        </span><span class="hs-special">}</span><span> </span><span class="annot"><span class="annottext">(TcRnIf TcGblEnv TcLclEnv TcGblEnv
 -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv)
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-704"></span><span>    </span><span id="local-6989586621681160844"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160844"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-705"></span><span>
</span><span id="line-706"></span><span>    </span><span class="hs-comment">-- Make sure we didn't refer to anything that doesn't actually exist</span><span>
</span><span id="line-707"></span><span>    </span><span class="hs-comment">-- pprTrace &quot;mergeSignatures: exports_from_avail&quot; (ppr exports) $ return ()</span><span>
</span><span id="line-708"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681160843"><span class="annot"><span class="annottext">Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])]
</span><a href="#local-6989586621681160843"><span class="hs-identifier hs-var">mb_lies</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe (Located [LIE GhcPs])
-&gt; GlobalRdrEnv
-&gt; ImportAvails
-&gt; Module
-&gt; TcRn
     (Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])],
      [AvailInfo])
</span><a href="GHC.Tc.Gen.Export.html#exports_from_avail"><span class="hs-identifier hs-var">exports_from_avail</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Located [LIE GhcPs])
</span><a href="#local-6989586621681160950"><span class="hs-identifier hs-var">mb_exports</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681160855"><span class="hs-identifier hs-var">rdr_env</span></a></span><span>
</span><span id="line-709"></span><span>                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; ImportAvails
</span><a href="GHC.Tc.Types.html#tcg_imports"><span class="hs-identifier hs-var hs-var">tcg_imports</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160844"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_semantic_mod"><span class="hs-identifier hs-var hs-var">tcg_semantic_mod</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160844"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-710"></span><span>
</span><span id="line-711"></span><span>    </span><span class="hs-comment">{- -- NB: This is commented out, because warns above is disabled.
    -- If you tried to explicitly export an identifier that has a warning
    -- attached to it, that's probably a mistake.  Warn about it.
    case mb_lies of
      Nothing -&gt; return ()
      Just lies -&gt;
        forM_ (concatMap (\(L loc x) -&gt; map (L loc) (ieNames x)) lies) $ \(L loc n) -&gt;
          setSrcSpan loc $
            unless (nameOccName n `elemOccSet` ok_to_use) $
                addWarn NoReason $ vcat [
                    text &quot;Exported identifier&quot; &lt;+&gt; quotes (ppr n) &lt;+&gt; text &quot;will cause warnings if used.&quot;,
                    parens (text &quot;To suppress this warning, remove&quot; &lt;+&gt; quotes (ppr n) &lt;+&gt; text &quot;from the export list of this signature.&quot;)
                    ]
    -}</span><span>
</span><span id="line-725"></span><span>
</span><span id="line-726"></span><span>    </span><span class="annot"><span class="annottext">TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#failIfErrsM"><span class="hs-identifier hs-var">failIfErrsM</span></a></span><span>
</span><span id="line-727"></span><span>
</span><span id="line-728"></span><span>    </span><span class="hs-comment">-- Save the exports</span><span>
</span><span id="line-729"></span><span>    </span><span class="annot"><span class="annottext">TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl a. gbl -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setGblEnv"><span class="hs-identifier hs-var">setGblEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160844"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcg_rn_exports :: Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])]
</span><a href="GHC.Tc.Types.html#tcg_rn_exports"><span class="hs-identifier hs-var">tcg_rn_exports</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe [(GenLocated SrcSpan (IE (GhcPass 'Renamed)), [AvailInfo])]
</span><a href="#local-6989586621681160843"><span class="hs-identifier hs-var">mb_lies</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="annot"><span class="annottext">(TcRnIf TcGblEnv TcLclEnv TcGblEnv
 -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv)
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-730"></span><span>    </span><span id="local-6989586621681160842"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160842"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-731"></span><span>
</span><span id="line-732"></span><span>    </span><span class="hs-comment">-- STEP 4: Rename the interfaces</span><span>
</span><span id="line-733"></span><span>    </span><span id="local-6989586621681160841"><span class="annot"><span class="annottext">[ModIface]
</span><a href="#local-6989586621681160841"><span class="hs-identifier hs-var">ext_ifaces</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(InstantiatedModule, ModIface)]
-&gt; ((InstantiatedModule, ModIface)
    -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [ModIface]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
t a -&gt; (a -&gt; m b) -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#forM"><span class="hs-identifier hs-var">forM</span></a></span><span> </span><span class="annot"><span class="annottext">[(InstantiatedModule, ModIface)]
</span><a href="#local-6989586621681160859"><span class="hs-identifier hs-var">thinned_ifaces</span></a></span><span> </span><span class="annot"><span class="annottext">(((InstantiatedModule, ModIface)
  -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface)
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) [ModIface])
-&gt; ((InstantiatedModule, ModIface)
    -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [ModIface]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span id="local-6989586621681160840"><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681160840"><span class="hs-identifier hs-var">iuid</span></a></span></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160839"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160839"><span class="hs-identifier hs-var">ireq_iface</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-734"></span><span>        </span><span class="annot"><span class="annottext">GenInstantiations UnitId
-&gt; Maybe NameShape
-&gt; ModIface
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface
</span><a href="GHC.Iface.Rename.html#tcRnModIface"><span class="hs-identifier hs-var">tcRnModIface</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InstantiatedUnit -&gt; GenInstantiations UnitId
forall unit. GenInstantiatedUnit unit -&gt; GenInstantiations unit
</span><a href="GHC.Unit.Types.html#instUnitInsts"><span class="hs-identifier hs-var hs-var">instUnitInsts</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681160840"><span class="hs-identifier hs-var">iuid</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NameShape -&gt; Maybe NameShape
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681160863"><span class="hs-identifier hs-var">nsubst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160839"><span class="hs-identifier hs-var">ireq_iface</span></a></span><span>
</span><span id="line-735"></span><span>    </span><span id="local-6989586621681160837"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160837"><span class="hs-identifier hs-var">lcl_iface</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GenInstantiations UnitId
-&gt; Maybe NameShape
-&gt; ModIface
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface
</span><a href="GHC.Iface.Rename.html#tcRnModIface"><span class="hs-identifier hs-var">tcRnModIface</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; GenInstantiations UnitId
</span><a href="GHC.Driver.Session.html#homeUnitInstantiations"><span class="hs-identifier hs-var hs-var">homeUnitInstantiations</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681160942"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NameShape -&gt; Maybe NameShape
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681160863"><span class="hs-identifier hs-var">nsubst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160946"><span class="hs-identifier hs-var">lcl_iface0</span></a></span><span>
</span><span id="line-736"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160835"><span class="annot"><span class="annottext">ifaces :: [ModIface]
</span><a href="#local-6989586621681160835"><span class="hs-identifier hs-var hs-var">ifaces</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160837"><span class="hs-identifier hs-var">lcl_iface</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; [ModIface] -&gt; [ModIface]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[ModIface]
</span><a href="#local-6989586621681160841"><span class="hs-identifier hs-var">ext_ifaces</span></a></span><span>
</span><span id="line-737"></span><span>
</span><span id="line-738"></span><span>    </span><span class="hs-comment">-- STEP 4.1: Merge fixities (we'll verify shortly) tcg_fix_env</span><span>
</span><span id="line-739"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160834"><span class="annot"><span class="annottext">fix_env :: NameEnv FixItem
</span><a href="#local-6989586621681160834"><span class="hs-identifier hs-var hs-var">fix_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Name, FixItem)] -&gt; NameEnv FixItem
forall a. [(Name, a)] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#mkNameEnv"><span class="hs-identifier hs-var">mkNameEnv</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Name
</span><a href="GHC.Types.Name.Reader.html#gre_name"><span class="hs-identifier hs-var hs-var">gre_name</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681160832"><span class="hs-identifier hs-var">rdr_elt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; Fixity -&gt; FixItem
</span><a href="GHC.Driver.Types.html#FixItem"><span class="hs-identifier hs-var">FixItem</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681160830"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681160829"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-740"></span><span>                            </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681160830"><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681160830"><span class="hs-identifier hs-var">occ</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160829"><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681160829"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(ModIface -&gt; [(OccName, Fixity)])
-&gt; [ModIface] -&gt; [(OccName, Fixity)]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; [(OccName, Fixity)]
forall (phase :: ModIfacePhase).
ModIface_ phase -&gt; [(OccName, Fixity)]
</span><a href="GHC.Driver.Types.html#mi_fixities"><span class="hs-identifier hs-var hs-var">mi_fixities</span></a></span><span> </span><span class="annot"><span class="annottext">[ModIface]
</span><a href="#local-6989586621681160835"><span class="hs-identifier hs-var">ifaces</span></a></span><span>
</span><span id="line-741"></span><span>                            </span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160832"><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681160832"><span class="hs-identifier hs-var">rdr_elt</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; OccName -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#lookupGlobalRdrEnv"><span class="hs-identifier hs-var">lookupGlobalRdrEnv</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681160855"><span class="hs-identifier hs-var">rdr_env</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681160830"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-742"></span><span>
</span><span id="line-743"></span><span>    </span><span class="hs-comment">-- STEP 5: Typecheck the interfaces</span><span>
</span><span id="line-744"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160826"><span class="annot"><span class="annottext">type_env_var :: TcRef TypeEnv
</span><a href="#local-6989586621681160826"><span class="hs-identifier hs-var hs-var">type_env_var</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRef TypeEnv
</span><a href="GHC.Tc.Types.html#tcg_type_env_var"><span class="hs-identifier hs-var hs-var">tcg_type_env_var</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160842"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-745"></span><span>
</span><span id="line-746"></span><span>    </span><span class="hs-comment">-- typecheckIfacesForMerging does two things:</span><span>
</span><span id="line-747"></span><span>    </span><span class="hs-comment">--      1. It merges the all of the ifaces together, and typechecks the</span><span>
</span><span id="line-748"></span><span>    </span><span class="hs-comment">--      result to type_env.</span><span>
</span><span id="line-749"></span><span>    </span><span class="hs-comment">--      2. It typechecks each iface individually, but with their 'Name's</span><span>
</span><span id="line-750"></span><span>    </span><span class="hs-comment">--      resolving to the merged type_env from (1).</span><span>
</span><span id="line-751"></span><span>    </span><span class="hs-comment">-- See typecheckIfacesForMerging for more details.</span><span>
</span><span id="line-752"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681160824"><span class="annot"><span class="annottext">TypeEnv
</span><a href="#local-6989586621681160824"><span class="hs-identifier hs-var">type_env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160823"><span class="annot"><span class="annottext">[ModDetails]
</span><a href="#local-6989586621681160823"><span class="hs-identifier hs-var">detailss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IfG (TypeEnv, [ModDetails]) -&gt; TcRn (TypeEnv, [ModDetails])
forall a. IfG a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#initIfaceTcRn"><span class="hs-identifier hs-var">initIfaceTcRn</span></a></span><span> </span><span class="annot"><span class="annottext">(IfG (TypeEnv, [ModDetails]) -&gt; TcRn (TypeEnv, [ModDetails]))
-&gt; IfG (TypeEnv, [ModDetails]) -&gt; TcRn (TypeEnv, [ModDetails])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-753"></span><span>                            </span><span class="annot"><span class="annottext">Module
-&gt; [ModIface] -&gt; TcRef TypeEnv -&gt; IfG (TypeEnv, [ModDetails])
forall lcl.
Module
-&gt; [ModIface] -&gt; TcRef TypeEnv -&gt; IfM lcl (TypeEnv, [ModDetails])
</span><a href="GHC.IfaceToCore.html#typecheckIfacesForMerging"><span class="hs-identifier hs-var">typecheckIfacesForMerging</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160931"><span class="hs-identifier hs-var">inner_mod</span></a></span><span> </span><span class="annot"><span class="annottext">[ModIface]
</span><a href="#local-6989586621681160835"><span class="hs-identifier hs-var">ifaces</span></a></span><span> </span><span class="annot"><span class="annottext">TcRef TypeEnv
</span><a href="#local-6989586621681160826"><span class="hs-identifier hs-var">type_env_var</span></a></span><span>
</span><span id="line-754"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160820"><span class="annot"><span class="annottext">infos :: [(ModIface, ModDetails)]
</span><a href="#local-6989586621681160820"><span class="hs-identifier hs-var hs-var">infos</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ModIface] -&gt; [ModDetails] -&gt; [(ModIface, ModDetails)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="annot"><span class="annottext">[ModIface]
</span><a href="#local-6989586621681160835"><span class="hs-identifier hs-var">ifaces</span></a></span><span> </span><span class="annot"><span class="annottext">[ModDetails]
</span><a href="#local-6989586621681160823"><span class="hs-identifier hs-var">detailss</span></a></span><span>
</span><span id="line-755"></span><span>
</span><span id="line-756"></span><span>    </span><span class="hs-comment">-- Test for cycles</span><span>
</span><span id="line-757"></span><span>    </span><span class="annot"><span class="annottext">Unit -&gt; [TyCon] -&gt; [LTyClDecl (GhcPass 'Renamed)] -&gt; TcRn ()
</span><a href="GHC.Tc.TyCl.Utils.html#checkSynCycles"><span class="hs-identifier hs-var">checkSynCycles</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Unit
</span><a href="GHC.Driver.Session.html#homeUnit"><span class="hs-identifier hs-var">homeUnit</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681160942"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TypeEnv -&gt; [TyCon]
</span><a href="GHC.Driver.Types.html#typeEnvTyCons"><span class="hs-identifier hs-var">typeEnvTyCons</span></a></span><span> </span><span class="annot"><span class="annottext">TypeEnv
</span><a href="#local-6989586621681160824"><span class="hs-identifier hs-var">type_env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-758"></span><span>
</span><span id="line-759"></span><span>    </span><span class="hs-comment">-- NB on type_env: it contains NO dfuns.  DFuns are recorded inside</span><span>
</span><span id="line-760"></span><span>    </span><span class="hs-comment">-- detailss, and given a Name that doesn't correspond to anything real.  See</span><span>
</span><span id="line-761"></span><span>    </span><span class="hs-comment">-- also Note [Signature merging DFuns]</span><span>
</span><span id="line-762"></span><span>
</span><span id="line-763"></span><span>    </span><span class="hs-comment">-- Add the merged type_env to TcGblEnv, so that it gets serialized</span><span>
</span><span id="line-764"></span><span>    </span><span class="hs-comment">-- out when we finally write out the interface.</span><span>
</span><span id="line-765"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-766"></span><span>    </span><span class="hs-comment">-- NB: Why do we set tcg_tcs/tcg_patsyns/tcg_type_env directly,</span><span>
</span><span id="line-767"></span><span>    </span><span class="hs-comment">-- rather than use tcExtendGlobalEnv (the normal method to add newly</span><span>
</span><span id="line-768"></span><span>    </span><span class="hs-comment">-- defined types to TcGblEnv?)  tcExtendGlobalEnv adds these</span><span>
</span><span id="line-769"></span><span>    </span><span class="hs-comment">-- TyThings to 'tcg_type_env_var', which is consulted when</span><span>
</span><span id="line-770"></span><span>    </span><span class="hs-comment">-- we read in interfaces to tie the knot.  But *these TyThings themselves</span><span>
</span><span id="line-771"></span><span>    </span><span class="hs-comment">-- come from interface*, so that would result in deadlock.  Don't</span><span>
</span><span id="line-772"></span><span>    </span><span class="hs-comment">-- update it!</span><span>
</span><span id="line-773"></span><span>    </span><span class="annot"><span class="annottext">TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl a. gbl -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setGblEnv"><span class="hs-identifier hs-var">setGblEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160842"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-774"></span><span>        </span><span class="annot"><span class="annottext">tcg_tcs :: [TyCon]
</span><a href="GHC.Tc.Types.html#tcg_tcs"><span class="hs-identifier hs-var">tcg_tcs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TypeEnv -&gt; [TyCon]
</span><a href="GHC.Driver.Types.html#typeEnvTyCons"><span class="hs-identifier hs-var">typeEnvTyCons</span></a></span><span> </span><span class="annot"><span class="annottext">TypeEnv
</span><a href="#local-6989586621681160824"><span class="hs-identifier hs-var">type_env</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-775"></span><span>        </span><span class="annot"><span class="annottext">tcg_patsyns :: [PatSyn]
</span><a href="GHC.Tc.Types.html#tcg_patsyns"><span class="hs-identifier hs-var">tcg_patsyns</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TypeEnv -&gt; [PatSyn]
</span><a href="GHC.Driver.Types.html#typeEnvPatSyns"><span class="hs-identifier hs-var">typeEnvPatSyns</span></a></span><span> </span><span class="annot"><span class="annottext">TypeEnv
</span><a href="#local-6989586621681160824"><span class="hs-identifier hs-var">type_env</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-776"></span><span>        </span><span class="annot"><span class="annottext">tcg_type_env :: TypeEnv
</span><a href="GHC.Tc.Types.html#tcg_type_env"><span class="hs-identifier hs-var">tcg_type_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TypeEnv
</span><a href="#local-6989586621681160824"><span class="hs-identifier hs-var">type_env</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-777"></span><span>        </span><span class="annot"><span class="annottext">tcg_fix_env :: NameEnv FixItem
</span><a href="GHC.Tc.Types.html#tcg_fix_env"><span class="hs-identifier hs-var">tcg_fix_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameEnv FixItem
</span><a href="#local-6989586621681160834"><span class="hs-identifier hs-var">fix_env</span></a></span><span>
</span><span id="line-778"></span><span>        </span><span class="hs-special">}</span><span> </span><span class="annot"><span class="annottext">(TcRnIf TcGblEnv TcLclEnv TcGblEnv
 -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv)
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-779"></span><span>    </span><span id="local-6989586621681160811"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160811"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-780"></span><span>
</span><span id="line-781"></span><span>    </span><span class="hs-comment">-- STEP 6: Check for compatibility/merge things</span><span>
</span><span id="line-782"></span><span>    </span><span id="local-6989586621681160810"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160810"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681160809"><span class="annot"><span class="annottext">TcGblEnv
-&gt; (ModIface, ModDetails) -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
</span><a href="#local-6989586621681160809"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(TcGblEnv
 -&gt; (ModIface, ModDetails) -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv)
-&gt; TcGblEnv
-&gt; [(ModIface, ModDetails)]
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall (t :: * -&gt; *) (m :: * -&gt; *) b a.
(Foldable t, Monad m) =&gt;
(b -&gt; a -&gt; m b) -&gt; b -&gt; t a -&gt; m b
</span><a href="../../base/src/Control.Monad.html#foldM"><span class="hs-identifier hs-var">foldM</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
-&gt; (ModIface, ModDetails) -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
</span><a href="#local-6989586621681160809"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160811"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="annot"><span class="annottext">[(ModIface, ModDetails)]
</span><a href="#local-6989586621681160820"><span class="hs-identifier hs-var">infos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-783"></span><span>             </span><span class="annot"><span class="annottext">((TcGblEnv
  -&gt; (ModIface, ModDetails) -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv)
 -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv)
-&gt; (TcGblEnv
    -&gt; (ModIface, ModDetails) -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv)
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681160808"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160808"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681160807"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160807"><span class="hs-identifier hs-var">iface</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160806"><span class="annot"><span class="annottext">ModDetails
</span><a href="#local-6989586621681160806"><span class="hs-identifier hs-var">details</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-784"></span><span>
</span><span id="line-785"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160805"><span class="annot"><span class="annottext">check_export :: Name -&gt; TcRn ()
</span><a href="#local-6989586621681160805"><span class="hs-identifier hs-var hs-var">check_export</span></a></span></span><span> </span><span id="local-6989586621681160804"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681160804"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-786"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681160803"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681160803"><span class="hs-identifier hs-var">sig_thing</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TypeEnv -&gt; Name -&gt; Maybe TyThing
</span><a href="GHC.Driver.Types.html#lookupTypeEnv"><span class="hs-identifier hs-var">lookupTypeEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModDetails -&gt; TypeEnv
</span><a href="GHC.Driver.Types.html#md_types"><span class="hs-identifier hs-var hs-var">md_types</span></a></span><span> </span><span class="annot"><span class="annottext">ModDetails
</span><a href="#local-6989586621681160806"><span class="hs-identifier hs-var">details</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681160804"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-787"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TypeEnv -&gt; Name -&gt; Maybe TyThing
</span><a href="GHC.Driver.Types.html#lookupTypeEnv"><span class="hs-identifier hs-var">lookupTypeEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TypeEnv
</span><a href="#local-6989586621681160824"><span class="hs-identifier hs-var">type_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyThing -&gt; Name
forall a. NamedThing a =&gt; a -&gt; Name
</span><a href="GHC.Types.Name.html#getName"><span class="hs-identifier hs-var">getName</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681160803"><span class="hs-identifier hs-var">sig_thing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-788"></span><span>                  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681160801"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681160801"><span class="hs-identifier hs-var">thing</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; TyThing -&gt; TyThing -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Backpack.html#checkHsigDeclM"><span class="hs-identifier hs-var">checkHsigDeclM</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160807"><span class="hs-identifier hs-var">iface</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681160803"><span class="hs-identifier hs-var">sig_thing</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681160801"><span class="hs-identifier hs-var">thing</span></a></span><span>
</span><span id="line-789"></span><span>                  </span><span class="annot"><span class="annottext">Maybe TyThing
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; TcRn ()
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mergeSignatures: check_export&quot;</span></span><span>
</span><span id="line-790"></span><span>              </span><span class="hs-comment">-- Oops! We're looking for this export but it's</span><span>
</span><span id="line-791"></span><span>              </span><span class="hs-comment">-- not actually in the type environment of the signature's</span><span>
</span><span id="line-792"></span><span>              </span><span class="hs-comment">-- ModDetails.</span><span>
</span><span id="line-793"></span><span>              </span><span class="hs-comment">--</span><span>
</span><span id="line-794"></span><span>              </span><span class="hs-comment">-- NB: This case happens because the we're iterating</span><span>
</span><span id="line-795"></span><span>              </span><span class="hs-comment">-- over the union of all exports, so some interfaces</span><span>
</span><span id="line-796"></span><span>              </span><span class="hs-comment">-- won't have everything.  Note that md_exports is nonsense</span><span>
</span><span id="line-797"></span><span>              </span><span class="hs-comment">-- (it's the same as exports); maybe we should fix this</span><span>
</span><span id="line-798"></span><span>              </span><span class="hs-comment">-- eventually.</span><span>
</span><span id="line-799"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-800"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-801"></span><span>        </span><span class="annot"><span class="annottext">(Name -&gt; TcRn ()) -&gt; [Name] -&gt; TcRn ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcRn ()
</span><a href="#local-6989586621681160805"><span class="hs-identifier hs-var">check_export</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(AvailInfo -&gt; Name) -&gt; [AvailInfo] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; Name
</span><a href="GHC.Types.Avail.html#availName"><span class="hs-identifier hs-var">availName</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681160857"><span class="hs-identifier hs-var">exports</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-802"></span><span>
</span><span id="line-803"></span><span>        </span><span class="hs-comment">-- Note [Signature merging instances]</span><span>
</span><span id="line-804"></span><span>        </span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-805"></span><span>        </span><span class="hs-comment">-- Merge instances into the global environment.  The algorithm here is</span><span>
</span><span id="line-806"></span><span>        </span><span class="hs-comment">-- dumb and simple: if an instance has exactly the same DFun type</span><span>
</span><span id="line-807"></span><span>        </span><span class="hs-comment">-- (tested by 'memberInstEnv') as an existing instance, we drop it;</span><span>
</span><span id="line-808"></span><span>        </span><span class="hs-comment">-- otherwise, we add it even, even if this would cause overlap.</span><span>
</span><span id="line-809"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-810"></span><span>        </span><span class="hs-comment">-- Why don't we deduplicate instances with identical heads?  There's no</span><span>
</span><span id="line-811"></span><span>        </span><span class="hs-comment">-- good choice if they have premises:</span><span>
</span><span id="line-812"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-813"></span><span>        </span><span class="hs-comment">--      instance K1 a =&gt; K (T a)</span><span>
</span><span id="line-814"></span><span>        </span><span class="hs-comment">--      instance K2 a =&gt; K (T a)</span><span>
</span><span id="line-815"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-816"></span><span>        </span><span class="hs-comment">-- Why not eagerly error in this case?  The overlapping head does not</span><span>
</span><span id="line-817"></span><span>        </span><span class="hs-comment">-- necessarily mean that the instances are unimplementable: in fact,</span><span>
</span><span id="line-818"></span><span>        </span><span class="hs-comment">-- they may be implemented without overlap (if, for example, the</span><span>
</span><span id="line-819"></span><span>        </span><span class="hs-comment">-- implementing module has 'instance K (T a)'; both are implemented in</span><span>
</span><span id="line-820"></span><span>        </span><span class="hs-comment">-- this case.)  The implements test just checks that the wanteds are</span><span>
</span><span id="line-821"></span><span>        </span><span class="hs-comment">-- derivable assuming the givens.</span><span>
</span><span id="line-822"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-823"></span><span>        </span><span class="hs-comment">-- Still, overlapping instances with hypotheses like above are going</span><span>
</span><span id="line-824"></span><span>        </span><span class="hs-comment">-- to be a bad deal, because instance resolution when we're typechecking</span><span>
</span><span id="line-825"></span><span>        </span><span class="hs-comment">-- against the merged signature is going to have a bad time when</span><span>
</span><span id="line-826"></span><span>        </span><span class="hs-comment">-- there are overlapping heads like this: we never backtrack, so it</span><span>
</span><span id="line-827"></span><span>        </span><span class="hs-comment">-- may be difficult to see that a wanted is derivable.  For now,</span><span>
</span><span id="line-828"></span><span>        </span><span class="hs-comment">-- we hope that we get lucky / the overlapping instances never</span><span>
</span><span id="line-829"></span><span>        </span><span class="hs-comment">-- get used, but it is not a very good situation to be in.</span><span>
</span><span id="line-830"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-831"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160800"><span class="annot"><span class="annottext">merge_inst :: ([ClsInst], InstEnv) -&gt; ClsInst -&gt; ([ClsInst], InstEnv)
</span><a href="#local-6989586621681160800"><span class="hs-identifier hs-var hs-var">merge_inst</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681160799"><span class="annot"><span class="annottext">[ClsInst]
</span><a href="#local-6989586621681160799"><span class="hs-identifier hs-var">insts</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160798"><span class="annot"><span class="annottext">InstEnv
</span><a href="#local-6989586621681160798"><span class="hs-identifier hs-var">inst_env</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681160797"><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681160797"><span class="hs-identifier hs-var">inst</span></a></span></span><span>
</span><span id="line-832"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">InstEnv -&gt; ClsInst -&gt; Bool
</span><a href="GHC.Core.InstEnv.html#memberInstEnv"><span class="hs-identifier hs-var">memberInstEnv</span></a></span><span> </span><span class="annot"><span class="annottext">InstEnv
</span><a href="#local-6989586621681160798"><span class="hs-identifier hs-var">inst_env</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681160797"><span class="hs-identifier hs-var">inst</span></a></span><span> </span><span class="hs-comment">-- test DFun Type equality</span><span>
</span><span id="line-833"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[ClsInst]
</span><a href="#local-6989586621681160799"><span class="hs-identifier hs-var">insts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">InstEnv
</span><a href="#local-6989586621681160798"><span class="hs-identifier hs-var">inst_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-834"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-835"></span><span>                </span><span class="hs-comment">-- NB: is_dfun_name inst is still nonsense here,</span><span>
</span><span id="line-836"></span><span>                </span><span class="hs-comment">-- see Note [Signature merging DFuns]</span><span>
</span><span id="line-837"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681160797"><span class="hs-identifier hs-var">inst</span></a></span><span class="annot"><span class="annottext">ClsInst -&gt; [ClsInst] -&gt; [ClsInst]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[ClsInst]
</span><a href="#local-6989586621681160799"><span class="hs-identifier hs-var">insts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">InstEnv -&gt; ClsInst -&gt; InstEnv
</span><a href="GHC.Core.InstEnv.html#extendInstEnv"><span class="hs-identifier hs-var">extendInstEnv</span></a></span><span> </span><span class="annot"><span class="annottext">InstEnv
</span><a href="#local-6989586621681160798"><span class="hs-identifier hs-var">inst_env</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681160797"><span class="hs-identifier hs-var">inst</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-838"></span><span>            </span><span class="hs-special">(</span><span id="local-6989586621681160794"><span class="annot"><span class="annottext">[ClsInst]
</span><a href="#local-6989586621681160794"><span class="hs-identifier hs-var">insts</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160793"><span class="annot"><span class="annottext">InstEnv
</span><a href="#local-6989586621681160793"><span class="hs-identifier hs-var">inst_env</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(([ClsInst], InstEnv) -&gt; ClsInst -&gt; ([ClsInst], InstEnv))
-&gt; ([ClsInst], InstEnv) -&gt; [ClsInst] -&gt; ([ClsInst], InstEnv)
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">([ClsInst], InstEnv) -&gt; ClsInst -&gt; ([ClsInst], InstEnv)
</span><a href="#local-6989586621681160800"><span class="hs-identifier hs-var">merge_inst</span></a></span><span>
</span><span id="line-839"></span><span>                                    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; [ClsInst]
</span><a href="GHC.Tc.Types.html#tcg_insts"><span class="hs-identifier hs-var hs-var">tcg_insts</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160808"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; InstEnv
</span><a href="GHC.Tc.Types.html#tcg_inst_env"><span class="hs-identifier hs-var hs-var">tcg_inst_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160808"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-840"></span><span>                                    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModDetails -&gt; [ClsInst]
</span><a href="GHC.Driver.Types.html#md_insts"><span class="hs-identifier hs-var hs-var">md_insts</span></a></span><span> </span><span class="annot"><span class="annottext">ModDetails
</span><a href="#local-6989586621681160806"><span class="hs-identifier hs-var">details</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-841"></span><span>            </span><span class="hs-comment">-- This is a HACK to prevent calculateAvails from including imp_mod</span><span>
</span><span id="line-842"></span><span>            </span><span class="hs-comment">-- in the listing.  We don't want it because a module is NOT</span><span>
</span><span id="line-843"></span><span>            </span><span class="hs-comment">-- supposed to include itself in its dep_orphs/dep_finsts.  See #13214</span><span>
</span><span id="line-844"></span><span>            </span><span id="local-6989586621681160791"><span class="annot"><span class="annottext">iface' :: ModIface
</span><a href="#local-6989586621681160791"><span class="hs-identifier hs-var hs-var">iface'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160807"><span class="hs-identifier hs-var">iface</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mi_final_exts :: IfaceBackendExts 'ModIfaceFinal
</span><a href="GHC.Driver.Types.html#mi_final_exts"><span class="hs-identifier hs-var">mi_final_exts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; IfaceBackendExts 'ModIfaceFinal
forall (phase :: ModIfacePhase).
ModIface_ phase -&gt; IfaceBackendExts phase
</span><a href="GHC.Driver.Types.html#mi_final_exts"><span class="hs-identifier hs-var hs-var">mi_final_exts</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160807"><span class="hs-identifier hs-var">iface</span></a></span><span class="hs-special">)</span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mi_orphan :: Bool
</span><a href="GHC.Driver.Types.html#mi_orphan"><span class="hs-identifier hs-var">mi_orphan</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mi_finsts :: Bool
</span><a href="GHC.Driver.Types.html#mi_finsts"><span class="hs-identifier hs-var">mi_finsts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-845"></span><span>            </span><span id="local-6989586621681160788"><span class="annot"><span class="annottext">avails :: ImportAvails
</span><a href="#local-6989586621681160788"><span class="hs-identifier hs-var hs-var">avails</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImportAvails -&gt; ImportAvails -&gt; ImportAvails
</span><a href="GHC.Tc.Types.html#plusImportAvails"><span class="hs-identifier hs-var">plusImportAvails</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; ImportAvails
</span><a href="GHC.Tc.Types.html#tcg_imports"><span class="hs-identifier hs-var hs-var">tcg_imports</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160808"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(ImportAvails -&gt; ImportAvails) -&gt; ImportAvails -&gt; ImportAvails
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-846"></span><span>                        </span><span class="annot"><span class="annottext">DynFlags
-&gt; ModIface
-&gt; Bool
-&gt; IsBootInterface
-&gt; ImportedBy
-&gt; ImportAvails
</span><a href="GHC.Rename.Names.html#calculateAvails"><span class="hs-identifier hs-var">calculateAvails</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681160942"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160791"><span class="hs-identifier hs-var">iface'</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#NotBoot"><span class="hs-identifier hs-var">NotBoot</span></a></span><span> </span><span class="annot"><span class="annottext">ImportedBy
</span><a href="GHC.Driver.Types.html#ImportedBySystem"><span class="hs-identifier hs-var">ImportedBySystem</span></a></span><span>
</span><span id="line-847"></span><span>        </span><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160808"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-848"></span><span>            </span><span class="annot"><span class="annottext">tcg_inst_env :: InstEnv
</span><a href="GHC.Tc.Types.html#tcg_inst_env"><span class="hs-identifier hs-var">tcg_inst_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstEnv
</span><a href="#local-6989586621681160793"><span class="hs-identifier hs-var">inst_env</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-849"></span><span>            </span><span class="annot"><span class="annottext">tcg_insts :: [ClsInst]
</span><a href="GHC.Tc.Types.html#tcg_insts"><span class="hs-identifier hs-var">tcg_insts</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ClsInst]
</span><a href="#local-6989586621681160794"><span class="hs-identifier hs-var">insts</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-850"></span><span>            </span><span class="annot"><span class="annottext">tcg_imports :: ImportAvails
</span><a href="GHC.Tc.Types.html#tcg_imports"><span class="hs-identifier hs-var">tcg_imports</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImportAvails
</span><a href="#local-6989586621681160788"><span class="hs-identifier hs-var">avails</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-851"></span><span>            </span><span class="annot"><span class="annottext">tcg_merged :: [(Module, Fingerprint)]
</span><a href="GHC.Tc.Types.html#tcg_merged"><span class="hs-identifier hs-var">tcg_merged</span></a></span><span>   </span><span class="hs-glyph">=</span><span>
</span><span id="line-852"></span><span>                </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160933"><span class="hs-identifier hs-var">outer_mod</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; Module -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; Module
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; Module
</span><a href="GHC.Driver.Types.html#mi_module"><span class="hs-identifier hs-var hs-var">mi_module</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160807"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-853"></span><span>                    </span><span class="hs-comment">-- Don't add ourselves!</span><span>
</span><span id="line-854"></span><span>                    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; [(Module, Fingerprint)]
</span><a href="GHC.Tc.Types.html#tcg_merged"><span class="hs-identifier hs-var hs-var">tcg_merged</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160808"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-855"></span><span>                    </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; Module
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; Module
</span><a href="GHC.Driver.Types.html#mi_module"><span class="hs-identifier hs-var hs-var">mi_module</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160807"><span class="hs-identifier hs-var">iface</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ModIfaceBackend -&gt; Fingerprint
</span><a href="GHC.Driver.Types.html#mi_mod_hash"><span class="hs-identifier hs-var hs-var">mi_mod_hash</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; IfaceBackendExts 'ModIfaceFinal
forall (phase :: ModIfacePhase).
ModIface_ phase -&gt; IfaceBackendExts phase
</span><a href="GHC.Driver.Types.html#mi_final_exts"><span class="hs-identifier hs-var hs-var">mi_final_exts</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160807"><span class="hs-identifier hs-var">iface</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Module, Fingerprint)
-&gt; [(Module, Fingerprint)] -&gt; [(Module, Fingerprint)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; [(Module, Fingerprint)]
</span><a href="GHC.Tc.Types.html#tcg_merged"><span class="hs-identifier hs-var hs-var">tcg_merged</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160808"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-856"></span><span>            </span><span class="hs-special">}</span><span>
</span><span id="line-857"></span><span>
</span><span id="line-858"></span><span>    </span><span class="hs-comment">-- Note [Signature merging DFuns]</span><span>
</span><span id="line-859"></span><span>    </span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-860"></span><span>    </span><span class="hs-comment">-- Once we know all of instances which will be defined by this merged</span><span>
</span><span id="line-861"></span><span>    </span><span class="hs-comment">-- signature, we go through each of the DFuns and rename them with a fresh,</span><span>
</span><span id="line-862"></span><span>    </span><span class="hs-comment">-- new, unique DFun Name, and add these DFuns to tcg_type_env (thus fixing</span><span>
</span><span id="line-863"></span><span>    </span><span class="hs-comment">-- up the &quot;bogus&quot; names that were setup in 'typecheckIfacesForMerging'.</span><span>
</span><span id="line-864"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-865"></span><span>    </span><span class="hs-comment">-- We can't do this fixup earlier, because we need a way to identify each</span><span>
</span><span id="line-866"></span><span>    </span><span class="hs-comment">-- source DFun (from each of the signatures we are merging in) so that</span><span>
</span><span id="line-867"></span><span>    </span><span class="hs-comment">-- when we have a ClsInst, we can pull up the correct DFun to check if</span><span>
</span><span id="line-868"></span><span>    </span><span class="hs-comment">-- the types match.</span><span>
</span><span id="line-869"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-870"></span><span>    </span><span class="hs-comment">-- See also Note [rnIfaceNeverExported] in GHC.Iface.Rename</span><span>
</span><span id="line-871"></span><span>    </span><span id="local-6989586621681160782"><span class="annot"><span class="annottext">[(Id, ClsInst)]
</span><a href="#local-6989586621681160782"><span class="hs-identifier hs-var">dfun_insts</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[ClsInst]
-&gt; (ClsInst -&gt; IOEnv (Env TcGblEnv TcLclEnv) (Id, ClsInst))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [(Id, ClsInst)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
t a -&gt; (a -&gt; m b) -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#forM"><span class="hs-identifier hs-var">forM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; [ClsInst]
</span><a href="GHC.Tc.Types.html#tcg_insts"><span class="hs-identifier hs-var hs-var">tcg_insts</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160810"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((ClsInst -&gt; IOEnv (Env TcGblEnv TcLclEnv) (Id, ClsInst))
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) [(Id, ClsInst)])
-&gt; (ClsInst -&gt; IOEnv (Env TcGblEnv TcLclEnv) (Id, ClsInst))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [(Id, ClsInst)]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681160781"><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681160781"><span class="hs-identifier hs-var">inst</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-872"></span><span>        </span><span id="local-6989586621681160780"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681160780"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Class -&gt; [Kind] -&gt; SrcSpan -&gt; TcM Name
</span><a href="GHC.Tc.Utils.Env.html#newDFunName"><span class="hs-identifier hs-var">newDFunName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClsInst -&gt; Class
</span><a href="GHC.Core.InstEnv.html#is_cls"><span class="hs-identifier hs-var hs-var">is_cls</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681160781"><span class="hs-identifier hs-var">inst</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClsInst -&gt; [Kind]
</span><a href="GHC.Core.InstEnv.html#is_tys"><span class="hs-identifier hs-var hs-var">is_tys</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681160781"><span class="hs-identifier hs-var">inst</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SrcSpan
</span><a href="GHC.Types.Name.html#nameSrcSpan"><span class="hs-identifier hs-var">nameSrcSpan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClsInst -&gt; Name
</span><a href="GHC.Core.InstEnv.html#is_dfun_name"><span class="hs-identifier hs-var hs-var">is_dfun_name</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681160781"><span class="hs-identifier hs-var">inst</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-873"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160775"><span class="annot"><span class="annottext">dfun :: Id
</span><a href="#local-6989586621681160775"><span class="hs-identifier hs-var hs-var">dfun</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Name -&gt; Id
</span><a href="GHC.Types.Var.html#setVarName"><span class="hs-identifier hs-var">setVarName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ClsInst -&gt; Id
</span><a href="GHC.Core.InstEnv.html#is_dfun"><span class="hs-identifier hs-var hs-var">is_dfun</span></a></span><span> </span><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681160781"><span class="hs-identifier hs-var">inst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681160780"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-874"></span><span>        </span><span class="annot"><span class="annottext">(Id, ClsInst) -&gt; IOEnv (Env TcGblEnv TcLclEnv) (Id, ClsInst)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681160775"><span class="hs-identifier hs-var">dfun</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ClsInst
</span><a href="#local-6989586621681160781"><span class="hs-identifier hs-var">inst</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">is_dfun_name :: Name
</span><a href="GHC.Core.InstEnv.html#is_dfun_name"><span class="hs-identifier hs-var">is_dfun_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681160780"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">is_dfun :: Id
</span><a href="GHC.Core.InstEnv.html#is_dfun"><span class="hs-identifier hs-var">is_dfun</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681160775"><span class="hs-identifier hs-var">dfun</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-875"></span><span>    </span><span id="local-6989586621681160772"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160772"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160810"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-876"></span><span>            </span><span class="annot"><span class="annottext">tcg_insts :: [ClsInst]
</span><a href="GHC.Tc.Types.html#tcg_insts"><span class="hs-identifier hs-var">tcg_insts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Id, ClsInst) -&gt; ClsInst) -&gt; [(Id, ClsInst)] -&gt; [ClsInst]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(Id, ClsInst) -&gt; ClsInst
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, ClsInst)]
</span><a href="#local-6989586621681160782"><span class="hs-identifier hs-var">dfun_insts</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-877"></span><span>            </span><span class="annot"><span class="annottext">tcg_type_env :: TypeEnv
</span><a href="GHC.Tc.Types.html#tcg_type_env"><span class="hs-identifier hs-var">tcg_type_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TypeEnv -&gt; [Id] -&gt; TypeEnv
</span><a href="GHC.Driver.Types.html#extendTypeEnvWithIds"><span class="hs-identifier hs-var">extendTypeEnvWithIds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; TypeEnv
</span><a href="GHC.Tc.Types.html#tcg_type_env"><span class="hs-identifier hs-var hs-var">tcg_type_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160810"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Id, ClsInst) -&gt; Id) -&gt; [(Id, ClsInst)] -&gt; [Id]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(Id, ClsInst) -&gt; Id
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, ClsInst)]
</span><a href="#local-6989586621681160782"><span class="hs-identifier hs-var">dfun_insts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-878"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-879"></span><span>
</span><span id="line-880"></span><span>    </span><span class="annot"><span class="annottext">[String] -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#addDependentFiles"><span class="hs-identifier hs-var">addDependentFiles</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621681160948"><span class="hs-identifier hs-var">src_files</span></a></span><span>
</span><span id="line-881"></span><span>
</span><span id="line-882"></span><span>    </span><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160772"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-883"></span><span>
</span><span id="line-884"></span><span class="hs-comment">-- | Top-level driver for signature instantiation (run when compiling</span><span>
</span><span id="line-885"></span><span class="hs-comment">-- an @hsig@ file.)</span><span>
</span><span id="line-886"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#tcRnInstantiateSignature"><span class="hs-identifier hs-type">tcRnInstantiateSignature</span></a></span><span> </span><span class="hs-glyph">::</span><span>
</span><span id="line-887"></span><span>    </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#RealSrcSpan"><span class="hs-identifier hs-type">RealSrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-888"></span><span>    </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Error.html#Messages"><span class="hs-identifier hs-type">Messages</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-889"></span><span id="tcRnInstantiateSignature"><span class="annot"><span class="annottext">tcRnInstantiateSignature :: HscEnv -&gt; Module -&gt; RealSrcSpan -&gt; IO (Messages, Maybe TcGblEnv)
</span><a href="GHC.Tc.Utils.Backpack.html#tcRnInstantiateSignature"><span class="hs-identifier hs-var hs-var">tcRnInstantiateSignature</span></a></span></span><span> </span><span id="local-6989586621681160769"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681160769"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681160768"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160768"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span id="local-6989586621681160767"><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621681160767"><span class="hs-identifier hs-var">real_loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-890"></span><span>   </span><span class="annot"><span class="annottext">DynFlags
-&gt; SDoc
-&gt; ((Messages, Maybe TcGblEnv) -&gt; ())
-&gt; IO (Messages, Maybe TcGblEnv)
-&gt; IO (Messages, Maybe TcGblEnv)
forall (m :: * -&gt; *) a.
MonadIO m =&gt;
DynFlags -&gt; SDoc -&gt; (a -&gt; ()) -&gt; m a -&gt; m a
</span><a href="GHC.Utils.Error.html#withTiming"><span class="hs-identifier hs-var">withTiming</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681160766"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-891"></span><span>              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Signature instantiation&quot;</span></span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#brackets"><span class="hs-identifier hs-var">brackets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160768"><span class="hs-identifier hs-var">this_mod</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-892"></span><span>              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">() -&gt; (Messages, Maybe TcGblEnv) -&gt; ()
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO (Messages, Maybe TcGblEnv) -&gt; IO (Messages, Maybe TcGblEnv))
-&gt; IO (Messages, Maybe TcGblEnv) -&gt; IO (Messages, Maybe TcGblEnv)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-893"></span><span>   </span><span class="annot"><span class="annottext">HscEnv
-&gt; HscSource
-&gt; Bool
-&gt; Module
-&gt; RealSrcSpan
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; IO (Messages, Maybe TcGblEnv)
forall r.
HscEnv
-&gt; HscSource
-&gt; Bool
-&gt; Module
-&gt; RealSrcSpan
-&gt; TcM r
-&gt; IO (Messages, Maybe r)
</span><a href="GHC.Tc.Utils.Monad.html#initTc"><span class="hs-identifier hs-var">initTc</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681160769"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">HscSource
</span><a href="GHC.Driver.Phases.html#HsigFile"><span class="hs-identifier hs-var">HsigFile</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160768"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621681160767"><span class="hs-identifier hs-var">real_loc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRnIf TcGblEnv TcLclEnv TcGblEnv
 -&gt; IO (Messages, Maybe TcGblEnv))
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; IO (Messages, Maybe TcGblEnv)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv TcGblEnv
</span><a href="GHC.Tc.Utils.Backpack.html#instantiateSignature"><span class="hs-identifier hs-var">instantiateSignature</span></a></span><span>
</span><span id="line-894"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-895"></span><span>   </span><span id="local-6989586621681160766"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681160766"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681160769"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-896"></span><span>
</span><span id="line-897"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#exportOccs"><span class="hs-identifier hs-type">exportOccs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccName"><span class="hs-identifier hs-type">OccName</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-898"></span><span id="exportOccs"><span class="annot"><span class="annottext">exportOccs :: [AvailInfo] -&gt; [OccName]
</span><a href="GHC.Tc.Utils.Backpack.html#exportOccs"><span class="hs-identifier hs-var hs-var">exportOccs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(AvailInfo -&gt; [OccName]) -&gt; [AvailInfo] -&gt; [OccName]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name -&gt; OccName) -&gt; [Name] -&gt; [OccName]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">([Name] -&gt; [OccName])
-&gt; (AvailInfo -&gt; [Name]) -&gt; AvailInfo -&gt; [OccName]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; [Name]
</span><a href="GHC.Types.Avail.html#availNames"><span class="hs-identifier hs-var">availNames</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-899"></span><span>
</span><span id="line-900"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#impl_msg"><span class="hs-identifier hs-type">impl_msg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#InstantiatedModule"><span class="hs-identifier hs-type">InstantiatedModule</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-901"></span><span id="impl_msg"><span class="annot"><span class="annottext">impl_msg :: Module -&gt; InstantiatedModule -&gt; SDoc
</span><a href="GHC.Tc.Utils.Backpack.html#impl_msg"><span class="hs-identifier hs-var hs-var">impl_msg</span></a></span></span><span> </span><span id="local-6989586621681160764"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160764"><span class="hs-identifier hs-var">impl_mod</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span id="local-6989586621681160763"><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681160763"><span class="hs-identifier hs-var">req_uid</span></a></span></span><span> </span><span id="local-6989586621681160762"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160762"><span class="hs-identifier hs-var">req_mod_name</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-902"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;while checking that&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160764"><span class="hs-identifier hs-var">impl_mod</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-903"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;implements signature&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160762"><span class="hs-identifier hs-var">req_mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-904"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;in&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681160763"><span class="hs-identifier hs-var">req_uid</span></a></span><span>
</span><span id="line-905"></span><span>
</span><span id="line-906"></span><span class="hs-comment">-- | Check if module implements a signature.  (The signature is</span><span>
</span><span id="line-907"></span><span class="hs-comment">-- always un-hashed, which is why its components are specified</span><span>
</span><span id="line-908"></span><span class="hs-comment">-- explicitly.)</span><span>
</span><span id="line-909"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#checkImplements"><span class="hs-identifier hs-type">checkImplements</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#InstantiatedModule"><span class="hs-identifier hs-type">InstantiatedModule</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span>
</span><span id="line-910"></span><span id="checkImplements"><span class="annot"><span class="annottext">checkImplements :: Module -&gt; InstantiatedModule -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
</span><a href="GHC.Tc.Utils.Backpack.html#checkImplements"><span class="hs-identifier hs-var hs-var">checkImplements</span></a></span></span><span> </span><span id="local-6989586621681160761"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160761"><span class="hs-identifier hs-var">impl_mod</span></a></span></span><span> </span><span id="local-6989586621681160760"><span class="annot"><span class="annottext">req_mod :: InstantiatedModule
</span><a href="#local-6989586621681160760"><span class="hs-identifier hs-var">req_mod</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span id="local-6989586621681160759"><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681160759"><span class="hs-identifier hs-var">uid</span></a></span></span><span> </span><span id="local-6989586621681160758"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160758"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-911"></span><span>  </span><span class="annot"><span class="annottext">SDoc
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall a. SDoc -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#addErrCtxt"><span class="hs-identifier hs-var">addErrCtxt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; InstantiatedModule -&gt; SDoc
</span><a href="GHC.Tc.Utils.Backpack.html#impl_msg"><span class="hs-identifier hs-var">impl_msg</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160761"><span class="hs-identifier hs-var">impl_mod</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedModule
</span><a href="#local-6989586621681160760"><span class="hs-identifier hs-var">req_mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcRnIf TcGblEnv TcLclEnv TcGblEnv
 -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv)
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-912"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160757"><span class="annot"><span class="annottext">insts :: GenInstantiations UnitId
</span><a href="#local-6989586621681160757"><span class="hs-identifier hs-var hs-var">insts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit -&gt; GenInstantiations UnitId
forall unit. GenInstantiatedUnit unit -&gt; GenInstantiations unit
</span><a href="GHC.Unit.Types.html#instUnitInsts"><span class="hs-identifier hs-var hs-var">instUnitInsts</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681160759"><span class="hs-identifier hs-var">uid</span></a></span><span>
</span><span id="line-913"></span><span>
</span><span id="line-914"></span><span>    </span><span class="hs-comment">-- STEP 1: Load the implementing interface, and make a RdrEnv</span><span>
</span><span id="line-915"></span><span>    </span><span class="hs-comment">-- for its exports.  Also, add its 'ImportAvails' to 'tcg_imports',</span><span>
</span><span id="line-916"></span><span>    </span><span class="hs-comment">-- so that we treat all orphan instances it provides as visible</span><span>
</span><span id="line-917"></span><span>    </span><span class="hs-comment">-- when we verify that all instances are checked (see #12945), and so that</span><span>
</span><span id="line-918"></span><span>    </span><span class="hs-comment">-- when we eventually write out the interface we record appropriate</span><span>
</span><span id="line-919"></span><span>    </span><span class="hs-comment">-- dependency information.</span><span>
</span><span id="line-920"></span><span>    </span><span id="local-6989586621681160756"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160756"><span class="hs-identifier hs-var">impl_iface</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IfG ModIface -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface
forall a. IfG a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#initIfaceTcRn"><span class="hs-identifier hs-var">initIfaceTcRn</span></a></span><span> </span><span class="annot"><span class="annottext">(IfG ModIface -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface)
-&gt; IfG ModIface -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-921"></span><span>        </span><span class="annot"><span class="annottext">SDoc -&gt; Module -&gt; IfG ModIface
forall lcl. SDoc -&gt; Module -&gt; IfM lcl ModIface
</span><a href="GHC.Iface.Load.html#loadSysInterface"><span class="hs-identifier hs-var">loadSysInterface</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;checkImplements 1&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160761"><span class="hs-identifier hs-var">impl_mod</span></a></span><span>
</span><span id="line-922"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160754"><span class="annot"><span class="annottext">impl_gr :: GlobalRdrEnv
</span><a href="#local-6989586621681160754"><span class="hs-identifier hs-var hs-var">impl_gr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt] -&gt; GlobalRdrEnv
</span><a href="GHC.Types.Name.Reader.html#mkGlobalRdrEnv"><span class="hs-identifier hs-var">mkGlobalRdrEnv</span></a></span><span>
</span><span id="line-923"></span><span>                    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe ImportSpec -&gt; [AvailInfo] -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#gresFromAvails"><span class="hs-identifier hs-var">gresFromAvails</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe ImportSpec
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; [AvailInfo]
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; [AvailInfo]
</span><a href="GHC.Driver.Types.html#mi_exports"><span class="hs-identifier hs-var hs-var">mi_exports</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160756"><span class="hs-identifier hs-var">impl_iface</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-924"></span><span>        </span><span id="local-6989586621681160753"><span class="annot"><span class="annottext">nsubst :: NameShape
</span><a href="#local-6989586621681160753"><span class="hs-identifier hs-var hs-var">nsubst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; [AvailInfo] -&gt; NameShape
</span><a href="GHC.Types.Name.Shape.html#mkNameShape"><span class="hs-identifier hs-var">mkNameShape</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160761"><span class="hs-identifier hs-var">impl_mod</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; [AvailInfo]
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; [AvailInfo]
</span><a href="GHC.Driver.Types.html#mi_exports"><span class="hs-identifier hs-var hs-var">mi_exports</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160756"><span class="hs-identifier hs-var">impl_iface</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-925"></span><span>
</span><span id="line-926"></span><span>    </span><span class="hs-comment">-- Load all the orphans, so the subsequent 'checkHsigIface' sees</span><span>
</span><span id="line-927"></span><span>    </span><span class="hs-comment">-- all the instances it needs to</span><span>
</span><span id="line-928"></span><span>    </span><span class="annot"><span class="annottext">SDoc -&gt; [Module] -&gt; TcRn ()
</span><a href="GHC.Iface.Load.html#loadModuleInterfaces"><span class="hs-identifier hs-var">loadModuleInterfaces</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Loading orphan modules (from implementor of hsig)&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-929"></span><span>                         </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Dependencies -&gt; [Module]
</span><a href="GHC.Driver.Types.html#dep_orphs"><span class="hs-identifier hs-var hs-var">dep_orphs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; Dependencies
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; Dependencies
</span><a href="GHC.Driver.Types.html#mi_deps"><span class="hs-identifier hs-var hs-var">mi_deps</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160756"><span class="hs-identifier hs-var">impl_iface</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-930"></span><span>
</span><span id="line-931"></span><span>    </span><span id="local-6989586621681160749"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681160749"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-932"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160748"><span class="annot"><span class="annottext">avails :: ImportAvails
</span><a href="#local-6989586621681160748"><span class="hs-identifier hs-var hs-var">avails</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; ModIface
-&gt; Bool
-&gt; IsBootInterface
-&gt; ImportedBy
-&gt; ImportAvails
</span><a href="GHC.Rename.Names.html#calculateAvails"><span class="hs-identifier hs-var">calculateAvails</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681160749"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-933"></span><span>                    </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160756"><span class="hs-identifier hs-var">impl_iface</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-comment">{- safe -}</span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#NotBoot"><span class="hs-identifier hs-var">NotBoot</span></a></span><span> </span><span class="annot"><span class="annottext">ImportedBy
</span><a href="GHC.Driver.Types.html#ImportedBySystem"><span class="hs-identifier hs-var">ImportedBySystem</span></a></span><span>
</span><span id="line-934"></span><span>        </span><span id="local-6989586621681160747"><span class="annot"><span class="annottext">fix_env :: NameEnv FixItem
</span><a href="#local-6989586621681160747"><span class="hs-identifier hs-var hs-var">fix_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Name, FixItem)] -&gt; NameEnv FixItem
forall a. [(Name, a)] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#mkNameEnv"><span class="hs-identifier hs-var">mkNameEnv</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Name
</span><a href="GHC.Types.Name.Reader.html#gre_name"><span class="hs-identifier hs-var hs-var">gre_name</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681160746"><span class="hs-identifier hs-var">rdr_elt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; Fixity -&gt; FixItem
</span><a href="GHC.Driver.Types.html#FixItem"><span class="hs-identifier hs-var">FixItem</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681160745"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681160744"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-935"></span><span>                            </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681160745"><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681160745"><span class="hs-identifier hs-var">occ</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160744"><span class="annot"><span class="annottext">Fixity
</span><a href="#local-6989586621681160744"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; [(OccName, Fixity)]
forall (phase :: ModIfacePhase).
ModIface_ phase -&gt; [(OccName, Fixity)]
</span><a href="GHC.Driver.Types.html#mi_fixities"><span class="hs-identifier hs-var hs-var">mi_fixities</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160756"><span class="hs-identifier hs-var">impl_iface</span></a></span><span>
</span><span id="line-936"></span><span>                            </span><span class="hs-special">,</span><span> </span><span id="local-6989586621681160746"><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681160746"><span class="hs-identifier hs-var">rdr_elt</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; OccName -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#lookupGlobalRdrEnv"><span class="hs-identifier hs-var">lookupGlobalRdrEnv</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681160754"><span class="hs-identifier hs-var">impl_gr</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681160745"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-937"></span><span>    </span><span class="annot"><span class="annottext">(TcGblEnv -&gt; TcGblEnv)
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl a.
(gbl -&gt; gbl) -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#updGblEnv"><span class="hs-identifier hs-var">updGblEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681160743"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160743"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160743"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-938"></span><span>        </span><span class="hs-comment">-- Setting tcg_rdr_env to treat all exported entities from</span><span>
</span><span id="line-939"></span><span>        </span><span class="hs-comment">-- the implementing module as in scope improves error messages,</span><span>
</span><span id="line-940"></span><span>        </span><span class="hs-comment">-- as it reduces the amount of qualification we need.  Unfortunately,</span><span>
</span><span id="line-941"></span><span>        </span><span class="hs-comment">-- we still end up qualifying references to external modules</span><span>
</span><span id="line-942"></span><span>        </span><span class="hs-comment">-- (see bkpfail07 for an example); we'd need to record more</span><span>
</span><span id="line-943"></span><span>        </span><span class="hs-comment">-- information in ModIface to solve this.</span><span>
</span><span id="line-944"></span><span>        </span><span class="annot"><span class="annottext">tcg_rdr_env :: GlobalRdrEnv
</span><a href="GHC.Tc.Types.html#tcg_rdr_env"><span class="hs-identifier hs-var">tcg_rdr_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; GlobalRdrEnv
</span><a href="GHC.Tc.Types.html#tcg_rdr_env"><span class="hs-identifier hs-var hs-var">tcg_rdr_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160743"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; GlobalRdrEnv -&gt; GlobalRdrEnv
</span><a href="GHC.Types.Name.Reader.html#plusGlobalRdrEnv"><span class="hs-operator hs-var">`plusGlobalRdrEnv`</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681160754"><span class="hs-identifier hs-var">impl_gr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-945"></span><span>        </span><span class="annot"><span class="annottext">tcg_imports :: ImportAvails
</span><a href="GHC.Tc.Types.html#tcg_imports"><span class="hs-identifier hs-var">tcg_imports</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; ImportAvails
</span><a href="GHC.Tc.Types.html#tcg_imports"><span class="hs-identifier hs-var hs-var">tcg_imports</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160743"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="annot"><span class="annottext">ImportAvails -&gt; ImportAvails -&gt; ImportAvails
</span><a href="GHC.Tc.Types.html#plusImportAvails"><span class="hs-operator hs-var">`plusImportAvails`</span></a></span><span> </span><span class="annot"><span class="annottext">ImportAvails
</span><a href="#local-6989586621681160748"><span class="hs-identifier hs-var">avails</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-946"></span><span>        </span><span class="hs-comment">-- This is here so that when we call 'lookupFixityRn' for something</span><span>
</span><span id="line-947"></span><span>        </span><span class="hs-comment">-- directly implemented by the module, we grab the right thing</span><span>
</span><span id="line-948"></span><span>        </span><span class="annot"><span class="annottext">tcg_fix_env :: NameEnv FixItem
</span><a href="GHC.Tc.Types.html#tcg_fix_env"><span class="hs-identifier hs-var">tcg_fix_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameEnv FixItem
</span><a href="#local-6989586621681160747"><span class="hs-identifier hs-var">fix_env</span></a></span><span>
</span><span id="line-949"></span><span>        </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcRnIf TcGblEnv TcLclEnv TcGblEnv
 -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv)
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-950"></span><span>
</span><span id="line-951"></span><span>    </span><span class="hs-comment">-- STEP 2: Load the *unrenamed, uninstantiated* interface for</span><span>
</span><span id="line-952"></span><span>    </span><span class="hs-comment">-- the ORIGINAL signature.  We are going to eventually rename it,</span><span>
</span><span id="line-953"></span><span>    </span><span class="hs-comment">-- but we must proceed slowly, because it is NOT known if the</span><span>
</span><span id="line-954"></span><span>    </span><span class="hs-comment">-- instantiation is correct.</span><span>
</span><span id="line-955"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160742"><span class="annot"><span class="annottext">sig_mod :: Module
</span><a href="#local-6989586621681160742"><span class="hs-identifier hs-var hs-var">sig_mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unit -&gt; ModuleName -&gt; Module
forall unit. unit -&gt; ModuleName -&gt; GenModule unit
</span><a href="GHC.Unit.Types.html#mkModule"><span class="hs-identifier hs-var">mkModule</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InstantiatedUnit -&gt; Unit
forall uid. GenInstantiatedUnit uid -&gt; GenUnit uid
</span><a href="GHC.Unit.Types.html#VirtUnit"><span class="hs-identifier hs-var">VirtUnit</span></a></span><span> </span><span class="annot"><span class="annottext">InstantiatedUnit
</span><a href="#local-6989586621681160759"><span class="hs-identifier hs-var">uid</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681160758"><span class="hs-identifier hs-var">mod_name</span></a></span><span>
</span><span id="line-956"></span><span>        </span><span id="local-6989586621681160741"><span class="annot"><span class="annottext">isig_mod :: InstalledModule
</span><a href="#local-6989586621681160741"><span class="hs-identifier hs-var hs-var">isig_mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(InstalledModule, Maybe InstantiatedModule) -&gt; InstalledModule
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; (InstalledModule, Maybe InstantiatedModule)
</span><a href="GHC.Unit.Module.html#getModuleInstantiation"><span class="hs-identifier hs-var">getModuleInstantiation</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160742"><span class="hs-identifier hs-var">sig_mod</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-957"></span><span>    </span><span id="local-6989586621681160740"><span class="annot"><span class="annottext">MaybeErr SDoc (ModIface, String)
</span><a href="#local-6989586621681160740"><span class="hs-identifier hs-var">mb_isig_iface</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SDoc
-&gt; InstalledModule
-&gt; Module
-&gt; IsBootInterface
-&gt; TcRnIf TcGblEnv TcLclEnv (MaybeErr SDoc (ModIface, String))
forall gbl lcl.
SDoc
-&gt; InstalledModule
-&gt; Module
-&gt; IsBootInterface
-&gt; TcRnIf gbl lcl (MaybeErr SDoc (ModIface, String))
</span><a href="GHC.Iface.Load.html#findAndReadIface"><span class="hs-identifier hs-var">findAndReadIface</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;checkImplements 2&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">InstalledModule
</span><a href="#local-6989586621681160741"><span class="hs-identifier hs-var">isig_mod</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160742"><span class="hs-identifier hs-var">sig_mod</span></a></span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#NotBoot"><span class="hs-identifier hs-var">NotBoot</span></a></span><span>
</span><span id="line-958"></span><span>    </span><span id="local-6989586621681160739"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160739"><span class="hs-identifier hs-var">isig_iface</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">MaybeErr SDoc (ModIface, String)
</span><a href="#local-6989586621681160740"><span class="hs-identifier hs-var">mb_isig_iface</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-959"></span><span>        </span><span class="annot"><a href="GHC.Data.Maybe.html#Succeeded"><span class="hs-identifier hs-type">Succeeded</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681160738"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160738"><span class="hs-identifier hs-var">iface</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160738"><span class="hs-identifier hs-var">iface</span></a></span><span>
</span><span id="line-960"></span><span>        </span><span class="annot"><a href="GHC.Data.Maybe.html#Failed"><span class="hs-identifier hs-type">Failed</span></a></span><span> </span><span id="local-6989586621681160737"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681160737"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface
forall a. SDoc -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#failWithTc"><span class="hs-identifier hs-var">failWithTc</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface)
-&gt; SDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-961"></span><span>            </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Could not find hi interface for signature&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-962"></span><span>                  </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InstalledModule -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">InstalledModule
</span><a href="#local-6989586621681160741"><span class="hs-identifier hs-var">isig_mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#colon"><span class="hs-identifier hs-var">colon</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681160737"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-963"></span><span>
</span><span id="line-964"></span><span>    </span><span class="hs-comment">-- STEP 3: Check that the implementing interface exports everything</span><span>
</span><span id="line-965"></span><span>    </span><span class="hs-comment">-- we need.  (Notice we IGNORE the Modules in the AvailInfos.)</span><span>
</span><span id="line-966"></span><span>    </span><span class="annot"><span class="annottext">[OccName] -&gt; (OccName -&gt; TcRn ()) -&gt; TcRn ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
t a -&gt; (a -&gt; m b) -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#forM_"><span class="hs-identifier hs-var">forM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[AvailInfo] -&gt; [OccName]
</span><a href="GHC.Tc.Utils.Backpack.html#exportOccs"><span class="hs-identifier hs-var">exportOccs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; [AvailInfo]
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; [AvailInfo]
</span><a href="GHC.Driver.Types.html#mi_exports"><span class="hs-identifier hs-var hs-var">mi_exports</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160739"><span class="hs-identifier hs-var">isig_iface</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((OccName -&gt; TcRn ()) -&gt; TcRn ())
-&gt; (OccName -&gt; TcRn ()) -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681160735"><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681160735"><span class="hs-identifier hs-var">occ</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-967"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv -&gt; OccName -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#lookupGlobalRdrEnv"><span class="hs-identifier hs-var">lookupGlobalRdrEnv</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681160754"><span class="hs-identifier hs-var">impl_gr</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681160735"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-968"></span><span>            </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#addErr"><span class="hs-identifier hs-var">addErr</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; TcRn ()) -&gt; SDoc -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccName -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681160735"><span class="hs-identifier hs-var">occ</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-969"></span><span>                    </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;is exported by the hsig file, but not&quot;</span></span><span>
</span><span id="line-970"></span><span>                    </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;exported by the implementing module&quot;</span></span><span>
</span><span id="line-971"></span><span>                    </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160761"><span class="hs-identifier hs-var">impl_mod</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-972"></span><span>            </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">() -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-973"></span><span>    </span><span class="annot"><span class="annottext">TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#failIfErrsM"><span class="hs-identifier hs-var">failIfErrsM</span></a></span><span>
</span><span id="line-974"></span><span>
</span><span id="line-975"></span><span>    </span><span class="hs-comment">-- STEP 4: Now that the export is complete, rename the interface...</span><span>
</span><span id="line-976"></span><span>    </span><span id="local-6989586621681160734"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160734"><span class="hs-identifier hs-var">sig_iface</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GenInstantiations UnitId
-&gt; Maybe NameShape
-&gt; ModIface
-&gt; IOEnv (Env TcGblEnv TcLclEnv) ModIface
</span><a href="GHC.Iface.Rename.html#tcRnModIface"><span class="hs-identifier hs-var">tcRnModIface</span></a></span><span> </span><span class="annot"><span class="annottext">GenInstantiations UnitId
</span><a href="#local-6989586621681160757"><span class="hs-identifier hs-var">insts</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NameShape -&gt; Maybe NameShape
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681160753"><span class="hs-identifier hs-var">nsubst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160739"><span class="hs-identifier hs-var">isig_iface</span></a></span><span>
</span><span id="line-977"></span><span>
</span><span id="line-978"></span><span>    </span><span class="hs-comment">-- STEP 5: ...and typecheck it.  (Note that in both cases, the nsubst</span><span>
</span><span id="line-979"></span><span>    </span><span class="hs-comment">-- lets us determine how top-level identifiers should be handled.)</span><span>
</span><span id="line-980"></span><span>    </span><span id="local-6989586621681160733"><span class="annot"><span class="annottext">ModDetails
</span><a href="#local-6989586621681160733"><span class="hs-identifier hs-var">sig_details</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IfG ModDetails -&gt; TcRn ModDetails
forall a. IfG a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#initIfaceTcRn"><span class="hs-identifier hs-var">initIfaceTcRn</span></a></span><span> </span><span class="annot"><span class="annottext">(IfG ModDetails -&gt; TcRn ModDetails)
-&gt; IfG ModDetails -&gt; TcRn ModDetails
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape -&gt; ModIface -&gt; IfG ModDetails
forall lcl. NameShape -&gt; ModIface -&gt; IfM lcl ModDetails
</span><a href="GHC.IfaceToCore.html#typecheckIfaceForInstantiate"><span class="hs-identifier hs-var">typecheckIfaceForInstantiate</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681160753"><span class="hs-identifier hs-var">nsubst</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160734"><span class="hs-identifier hs-var">sig_iface</span></a></span><span>
</span><span id="line-981"></span><span>
</span><span id="line-982"></span><span>    </span><span class="hs-comment">-- STEP 6: Check that it's sufficient</span><span>
</span><span id="line-983"></span><span>    </span><span id="local-6989586621681160731"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160731"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-984"></span><span>    </span><span class="annot"><span class="annottext">TcGblEnv -&gt; GlobalRdrEnv -&gt; ModIface -&gt; ModDetails -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Backpack.html#checkHsigIface"><span class="hs-identifier hs-var">checkHsigIface</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160731"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681160754"><span class="hs-identifier hs-var">impl_gr</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160734"><span class="hs-identifier hs-var">sig_iface</span></a></span><span> </span><span class="annot"><span class="annottext">ModDetails
</span><a href="#local-6989586621681160733"><span class="hs-identifier hs-var">sig_details</span></a></span><span>
</span><span id="line-985"></span><span>
</span><span id="line-986"></span><span>    </span><span class="hs-comment">-- STEP 7: Return the updated 'TcGblEnv' with the signature exports,</span><span>
</span><span id="line-987"></span><span>    </span><span class="hs-comment">-- so we write them out.</span><span>
</span><span id="line-988"></span><span>    </span><span class="annot"><span class="annottext">TcGblEnv -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160731"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-989"></span><span>        </span><span class="annot"><span class="annottext">tcg_exports :: [AvailInfo]
</span><a href="GHC.Tc.Types.html#tcg_exports"><span class="hs-identifier hs-var">tcg_exports</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModIface -&gt; [AvailInfo]
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; [AvailInfo]
</span><a href="GHC.Driver.Types.html#mi_exports"><span class="hs-identifier hs-var hs-var">mi_exports</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681160734"><span class="hs-identifier hs-var">sig_iface</span></a></span><span>
</span><span id="line-990"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-991"></span><span>
</span><span id="line-992"></span><span class="hs-comment">-- | Given 'tcg_mod', instantiate a 'ModIface' from the indefinite</span><span>
</span><span id="line-993"></span><span class="hs-comment">-- library to use the actual implementations of the relevant entities,</span><span>
</span><span id="line-994"></span><span class="hs-comment">-- checking that the implementation matches the signature.</span><span>
</span><span id="line-995"></span><span class="annot"><a href="GHC.Tc.Utils.Backpack.html#instantiateSignature"><span class="hs-identifier hs-type">instantiateSignature</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span>
</span><span id="line-996"></span><span id="instantiateSignature"><span class="annot"><span class="annottext">instantiateSignature :: TcRnIf TcGblEnv TcLclEnv TcGblEnv
</span><a href="GHC.Tc.Utils.Backpack.html#instantiateSignature"><span class="hs-identifier hs-var hs-var">instantiateSignature</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-997"></span><span>    </span><span id="local-6989586621681160730"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160730"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-998"></span><span>    </span><span id="local-6989586621681160729"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681160729"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-999"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160728"><span class="annot"><span class="annottext">outer_mod :: Module
</span><a href="#local-6989586621681160728"><span class="hs-identifier hs-var hs-var">outer_mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_mod"><span class="hs-identifier hs-var hs-var">tcg_mod</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160730"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-1000"></span><span>        </span><span id="local-6989586621681160727"><span class="annot"><span class="annottext">inner_mod :: Module
</span><a href="#local-6989586621681160727"><span class="hs-identifier hs-var hs-var">inner_mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; Module
</span><a href="GHC.Tc.Types.html#tcg_semantic_mod"><span class="hs-identifier hs-var hs-var">tcg_semantic_mod</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681160730"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-1001"></span><span>    </span><span class="hs-comment">-- TODO: setup the local RdrEnv so the error messages look a little better.</span><span>
</span><span id="line-1002"></span><span>    </span><span class="hs-comment">-- But this information isn't stored anywhere. Should we RETYPECHECK</span><span>
</span><span id="line-1003"></span><span>    </span><span class="hs-comment">-- the local one just to get the information?  Hmm...</span><span>
</span><span id="line-1004"></span><span>    </span><span class="hs-identifier">MASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isHomeModule</span><span> </span><span class="hs-identifier">dflags</span><span> </span><span class="hs-identifier">outer_mod</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1005"></span><span>    </span><span class="hs-identifier">MASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isJust</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">homeUnitInstanceOfId</span><span> </span><span class="hs-identifier">dflags</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1006"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681160721"><span class="annot"><span class="annottext">uid :: Indefinite UnitId
</span><a href="#local-6989586621681160721"><span class="hs-identifier hs-var hs-var">uid</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Indefinite UnitId) -&gt; Indefinite UnitId
forall a. HasCallStack =&gt; Maybe a -&gt; a
</span><a href="../../base/src/Data.Maybe.html#fromJust"><span class="hs-identifier hs-var">fromJust</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Maybe (Indefinite UnitId)
</span><a href="GHC.Driver.Session.html#homeUnitInstanceOfId"><span class="hs-identifier hs-var hs-var">homeUnitInstanceOfId</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681160729"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1007"></span><span>        </span><span class="hs-comment">-- we need to fetch the most recent ppr infos from the unit</span><span>
</span><span id="line-1008"></span><span>        </span><span class="hs-comment">-- database because we might have modified it</span><span>
</span><span id="line-1009"></span><span>        </span><span id="local-6989586621681160719"><span class="annot"><span class="annottext">uid' :: Indefinite UnitId
</span><a href="#local-6989586621681160719"><span class="hs-identifier hs-var hs-var">uid'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UnitState -&gt; Indefinite UnitId -&gt; Indefinite UnitId
</span><a href="GHC.Unit.State.html#updateIndefUnitId"><span class="hs-identifier hs-var">updateIndefUnitId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; UnitState
</span><a href="GHC.Driver.Session.html#unitState"><span class="hs-identifier hs-var hs-var">unitState</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681160729"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Indefinite UnitId
</span><a href="#local-6989586621681160721"><span class="hs-identifier hs-var">uid</span></a></span><span>
</span><span id="line-1010"></span><span>    </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160727"><span class="hs-identifier hs-var">inner_mod</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; InstantiatedModule -&gt; TcRnIf TcGblEnv TcLclEnv TcGblEnv
</span><a href="GHC.Tc.Utils.Backpack.html#checkImplements"><span class="hs-operator hs-var">`checkImplements`</span></a></span><span>
</span><span id="line-1011"></span><span>        </span><span class="annot"><span class="annottext">InstantiatedUnit -&gt; ModuleName -&gt; InstantiatedModule
forall unit. unit -&gt; ModuleName -&gt; GenModule unit
</span><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-var">Module</span></a></span><span>
</span><span id="line-1012"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Indefinite UnitId -&gt; GenInstantiations UnitId -&gt; InstantiatedUnit
</span><a href="GHC.Unit.Types.html#mkInstantiatedUnit"><span class="hs-identifier hs-var">mkInstantiatedUnit</span></a></span><span> </span><span class="annot"><span class="annottext">Indefinite UnitId
</span><a href="#local-6989586621681160719"><span class="hs-identifier hs-var">uid'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; GenInstantiations UnitId
</span><a href="GHC.Driver.Session.html#homeUnitInstantiations"><span class="hs-identifier hs-var hs-var">homeUnitInstantiations</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681160729"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1013"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681160728"><span class="hs-identifier hs-var">outer_mod</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1014"></span></pre></body></html>